Skydome depth and Daytime Shader Question

Started by
10 comments, last by szecs 14 years ago
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]
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.
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 ???
You should post some of your code so we can see exactly the way you made your skydome.
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();	}}
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?
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.
I don't understand. The dome doesn't fit to what?
^^ 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.
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.

This topic is closed to new replies.

Advertisement