Jump to content
  • Advertisement
Sign in to follow this  
lipsryme

Skydome depth and Daytime Shader Question

This topic is 3166 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Ok this is actually 2 questions I have. 1. I've got a skydome over my terrain with a sky texture pasted on it. I defined ZEnable = false in the shader so I won't see the depth difference to the horizon but you can still see that there's a dome all around me. How can I do something against that? 2. solved. [Edited by - lipsryme on April 17, 2010 8:35:20 AM]

Share this post


Link to post
Share on other sites
Advertisement
Not sure about the first question, but for the second part you could pass in a normalized (0 - 1) float value representing the time of day, with 1 being the brightest time and 0 being the darkest time. Then do something like color += dayColor * time + nightColor * (1 - time) to get your final color.

Share this post


Link to post
Share on other sites
Well I've managed to make it work and look good with the lerp function, interpolating between the color values.
But I still don't get how I can make the skydome look right...?
I've read that you have to draw the dome at your camera's position but if I'd do that wouldn't that move the dome all around and inside other geometry like the terrain ???

Share this post


Link to post
Share on other sites
Not sure why this drawing code would help but here it is:



void CGraphics::DrawSkydome()
{
// Set Variables
D3DXMatrixScaling(&m_matScale, 120.0f, 120.0f, 120.0f);
D3DXMatrixTranslation(&m_matTranslation, m_vec3CamPosition.x, m_vec3CamPosition.y, m_vec3CamPosition.z);
m_matWorld = m_matScale * m_matTranslation;

m_pD3DEffect->SetMatrix("xWorld", &m_matWorld);

// Set Technique
if(SUCCEEDED(m_pD3DEffect->SetTechnique("Skydome")))
{
UINT numberOfPasses;
m_pD3DEffect->Begin(&numberOfPasses, NULL);

for(UINT i = 0; i < numberOfPasses; i ++)
{
m_pD3DEffect->BeginPass(i);

// --> Draw Mesh here <--
m_pCMesh->RenderSkydomeMesh(m_pD3DDev9);


m_pD3DEffect->EndPass();
}

m_pD3DEffect->End();
}
}

Share this post


Link to post
Share on other sites
The camera always has to be in the center of the dome. So the dome will move with your camera. But since you don't write the depth buffer while rendering the dome, there's no problem (it won't intersect anything).

Or did I misunderstood something?

Share this post


Link to post
Share on other sites
Yes I get that but now when I move the camera up and down for example my skydome moves with me.
Which results in the problem that my terrain does not (even if it did I couldn't move forward then can I ?) and the sky doesn't fit anymore.

Share this post


Link to post
Share on other sites
^^ it doesn't fit to the rest of the scene because I move the skydome.
But I think I got it now. If I use an offset on the Y-value of the Skydome position I can somehow fit it to the scene.

Share this post


Link to post
Share on other sites
The skydome has to fit to the camera. Because it models an infinitely large dome. (just like a star-textured-sphere)

If it's fit to the scene, then it's simply a dome with a sky poster on it, which will fail miserably if you have large outdoor scenes (because you can go outside the dome).

Or maybe I still misunderstand the problem.

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!