Night Scene

hippokrates

08-04-2006 00:04:39

Well, I'm sorry to ask such a question, but I would like to create a scene that shows a terrain at night - and I have no idea how to do that. I searched around in the forums but I couldn't dig up anything useful so far.

My problem is that, while choosing a "starlit sky"-texture for my skybox makes the scene somewhat nightish, the terrain and the water plain I added remain their normal color. So the terrain is kind of too bright for a night scene ^^;
How could I adjust the colour of the terrain to become darker? I tried ambient lighting but it wouldn't work...

tuan kuranes

08-04-2006 07:36:33

If you want ambient and all working you need to enable normals and disable pixel shaders...
Or/and odify pixel shaders...

hippokrates

08-04-2006 22:45:58

I thought of writing a vertex shader that modifies the vertex color to simulate night by making the terrain darker. But adding a vertex shader just makes the detail texture disappear.
What kind of vertex attributes do I have to use in my vertex programme? Or is it impossible to combine a vertex shader with detail textures?

Falagard

09-04-2006 01:25:06

Of course it's possible to do anything with vertex shaders that you can do without. But it means you'll have to learn vertex shaders.

tuan kuranes

10-04-2006 08:10:22

@hippokrates : read current vertex and pixel shaders iused in PLSM2 and reuse/rewrite them to change accroding to your needs.

hippokrates

11-04-2006 13:45:14

I tried composing my own vertex shader but it won't work. Neither can I get the detail texture working nor does changing the vertex color have the desired effect.
This is my shader code (CG):

struct appdata
{
float4 iPosition : POSITION;
float4 iNormal : NORMAL;
float4 iColor : COLOR0;
float2 iTexcoord0 : TEXCOORD0;
float2 iTexcoord1 : TEXCOORD1;
};

struct vfconn
{
float4 oPosition : POSITION;
float4 oColor : COLOR0;
float2 oTexcoord0 : TEXCOORD0;
float2 oTexcoord1 : TEXCOORD1;
};


vfconn main_vp(appdata inData, uniform float4x4 worldViewProj)
{
vfconn outData;

outData.oPosition = mul(worldViewProj, inData.iPosition);
outData.oColor = inData.iColor * 1.0f;
outData.oTexcoord0 = inData.iTexcoord0;
outData.oTexcoord1 = inData.iTexcoord1;

return outData;
}


If I delete the the line with texcoor1 I get a terrain that has no detail texture and is colored like a rainbow. Only if I delete the color line as well, I get a normal looking terrain (without detail texture..)

tuan kuranes

11-04-2006 13:56:55

Color ?
Are you sure plsm2 exports Color information in Vertex ?
Night shader is more a Pixel Shader where you just darken the final color output according to your "night factor"

hippokrates

11-04-2006 15:03:13

Ah, I suspected it would turn out that way ^^;
Well, let's try a pixelshader then.