Dagon build problem with corona scene

imtrobin

15-04-2006 12:46:30

Hi

Reporting a problem with corona scene with dagon build. After some minor adjustments to the export, I can get it working with OSM_viewer. However, in dagon build demo scene, there are no corona on the car headlights.

Looking at the ogre.log, the dagon build produced these errors while retriving the shader parameters.



-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: GpuProgramParameters::getParamIndex
Description: Cannot find a parameter named coronaSize.
File: \OgreDev\Dagon\OgreMain\src\OgreGpuProgram.cpp
Line: 768
Stack unwinding: <<beginning of stack>>
19:24:49: Error in material 01_-_Light at line 19 of scene.material: Invalid param_named attribute - An exception has been thrown!

-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: GpuProgramParameters::getParamIndex
Description: Cannot find a parameter named view_proj_matrix.
File: \OgreDev\Dagon\OgreMain\src\OgreGpuProgram.cpp
Line: 768
Stack unwinding: <<beginning of stack>>
19:24:49: An exception has been thrown!

Lioric

15-04-2006 17:43:01

Dagon uses a different CG version (1.4) and it has some issues with constants

You can assign a defined register for the parameters in the shader code to force the cg compiler to use them

or you can use the shaders in HLSL that is commented out in the .program file

imtrobin

15-04-2006 20:16:18

I'm not too familiar with cg but it looks like the constants are already forced. This is the first few lines of the cg shader, which shows the defined constants.


float4x4 view_proj_matrix: register(c0);
float4x4 view_matrix: register(c4);
float4 pos0: register(c8);
float coronaSize: register(c9);
struct VS_OUTPUT {
float4 Pos: POSITION;
float2 texCoord: TEXCOORD0;
};


I tried using the HLSL shader instead, nope doesn't work. But the log parses the shader correctly, no exception thrown though. Seems to be the shader need some fixing too.

imtrobin

15-04-2006 20:18:44

My mistake, using the hlsl shader also gives the invalid parameters e.g


-----------------------------------
Details:
-----------------------------------
Error #: 7
Function: GpuProgramParameters::getParamIndex
Description: Cannot find a parameter named coronaDir.
File: \OgreDev\Dagon\OgreMain\src\OgreGpuProgram.cpp
Line: 768
Stack unwinding: <<beginning of stack>>
03:00:57: Error in material 01_-_Light at line 26 of scene.material: Invalid param_named attribute - An exception has been thrown!


imtrobin

16-04-2006 11:07:10

Hmm, I'm not getting this hlsl to work.

With the cg shader, all I need was to flip the coronaDir in scene.material from (0,1,0,0) to (0,-1,0,0). I didn't understand why the coronaDir is specified in Y axis instead of Z but it worked so I didn't care. Now it seems I must.

I noticed the pos0 has its Y and Z values flipped, that takes care of 3dsmax YZ coordinate flip, but also the Z is negated (2194.59 in 3dsmax, -2194.59 in scene.material). So I presume this flips the Z to opengl right hand coordinate system since it is CG?

Then in Corona_vs.source, the X and Y view vector are grabbed from row matrix, which confirms right hand system.

// Grab X and Y eye-space vectors in world-space ...
float3 dirX = view_matrix[0];
float3 dirY = view_matrix[1];


So I changed them to column major


float3 dirX = {view_matrix[0][0], view_matrix[1][0], view_matrix[2][0]};
float3 dirY = {view_matrix[0][1], view_matrix[1][1], view_matrix[2][1]};


So I'm so try changing the coronaDir to 0,0,1,0 and different combinations, but best I got is a full screen corona. What am I doing wrong?

Lioric

16-04-2006 19:07:01

the z change is for Ogre axis system, not for CG or OpenGL

It should work without modifications in HLSL, as i used it recently

I will test it later

imtrobin

19-04-2006 19:22:12

hi Lioric, any update on the issue?