Game Development Community

Blue Marble - To Guy Allard

by Matt Huston · in Torque Game Engine Advanced · 07/24/2008 (7:43 am) · 3 replies

This message is mostly for Guy Allard who wrote the Blue Marble demo available on his blog. He said that he would post the Atmosphere change code to the private forums somewhere but I can't seem to find those changes.

I had tried to email a couple times in the last week regarding the Atmosphere Shader. I notice you have created a new shader constant called VC_EYE_POS2 and you said that it was eye-pos with scale and I am not very sure what that exactly means.

Any help would be appreciated.

#1
07/27/2008 (10:56 am)
Sorry to take a while to respond to this.

The atmosphere shader needs a slightly different eye position supplied to it in order to render correctly. To do this, I made a shader constant called VC_EYE_POS2. To get this passed to the shaders, there's a couple of small changes to be made to the engine.

File: materials\processedShaderMaterial.cpp
function: setEyePosition(MatrixF objTrans, Point3F position, U32 pass)
before line: position.convolveInverse(objTrans.getScale());
add:
// store eye position with scale in VC_EYE_POS2
   Point3F pos2 = position;
   GFX->setVertexShaderConstF( VC_EYE_POS2, (float*)&pos2, 1 );


Then to make the shaders aware of this, you need to edit both of your shdrconsts.h files (one lives in game\shaders, and the other lives in game, no idea why there's 2) and assign a register to VC_EYE_POS2, e.g.
In the first section of the file,
After: #define VC_CUBE_TRANS C16
add: #define VC_EYE_POS2 C18

and then in the #else section
After: #define VC_CUBE_TRANS 16
#define VC_EYE_POS2 18

I think that's it. Hope it helps!
#2
07/29/2008 (2:29 am)
Thanks guy, I knew it was something real small like that but wasn't too sure where and what to implement. Much appreciated!
#3
07/29/2008 (3:12 am)
Guy, thanks for posting the code. I too was interested, but I didn't realize you had plans to release the changes.