0 registered members (),
1,459
guests, and 9
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: RE:3D Glasses shader
[Re: Scorpion]
#104870
01/04/07 12:56
01/04/07 12:56
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
OP
Senior Expert
|
OP
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
The borders have to be the same size I think, because it's the overlap of colors that will change the size of the borders anyways. Still, I have been looking on the internet for some examples and found out that most use a way thicker border for each color, so perhaps the current effect won't work.
I have to say though, if I would make a 3D glasses shader from scratch, I would probably make 3 layers of the total scene, one layer in red, one in blue and one for example green and change their offset and add them together.
As soon as I get my hands on 3D glasses, I will change the code some more,
Cheers
|
|
|
Re: RE:3D Glasses shader
[Re: ello]
#104872
01/04/07 13:36
01/04/07 13:36
|
Joined: Sep 2002
Posts: 8,177 Netherlands
PHeMoX
OP
Senior Expert
|
OP
Senior Expert
Joined: Sep 2002
Posts: 8,177
Netherlands
|
Quote:
for a real 3d-glass effect you'd need to take the depth information into account. the distance between the red and the blue extraction depends on the distance
Mmmm, okey, I wonder if this could be accomplished by using a fixed focal point in the center of the screen. At the moment I wouldn't really know how to change the thickness based on the position on screen, but if it needs the depth to even work. Maybe not quite worth it spending more time on this one?
Cheers
|
|
|
Re: RE:3D Glasses shader
[Re: ello]
#104874
01/04/07 15:43
01/04/07 15:43
|
Joined: Mar 2001
Posts: 3,298 Beverly, Massachusetts
Rhuarc
Expert
|
Expert
Joined: Mar 2001
Posts: 3,298
Beverly, Massachusetts
|
Quote:
well, i think it is worth, as it is a great effect to have some more 3d-feeling. while reading the thing about a focal point , you could be right.. maybe you have to take both the focal point and the depth into account for proper calculations
Yes, both are neccesary, although it wouldn't be a focal point, but rather a focal range- which would just be a value of distance that the camera is focusing on. You could do this by rendering with a second camera and use an alternate shader to render every element with depth information, then use this texture as a mtlTex and then use the values as your offset thickness.
-Rhuarc
|
|
|
Re: RE:3D Glasses shader
[Re: PHeMoX]
#104876
01/04/07 22:55
01/04/07 22:55
|
Joined: Jan 2007
Posts: 1,619 Germany
Scorpion
Serious User
|
Serious User
Joined: Jan 2007
Posts: 1,619
Germany
|
if you would have for every object its own deep, are problems with big objekts like terrain or just the whole level. so i would say the only possible thing is to render 2 views on the screen (red+green) Or is it possible to get the deep of every pixel?! *noobatshader*
|
|
|
Re: RE:3D Glasses shader
[Re: lostclimate]
#104879
01/05/07 08:00
01/05/07 08:00
|
Joined: Oct 2002
Posts: 8,939 planet.earth
ello
Senior Expert
|
Senior Expert
Joined: Oct 2002
Posts: 8,939
planet.earth
|
it is possible by using material events and for one view you only render the objexts with a greyscale depending on the depth. this could look like: Code:
struct VS_IN { float4 position : POSITION; };
struct VS_OUT { float4 position : POSITION; float depth : TEXCOORD0; };
float front = 100; float back = 300;
VS_OUT mainVS (VS_IN In) { VS_OUT Out; Out.position = mul(In.position, matWorldViewProj); Out.depth = ((Out.position.z - back)/1000) * ((Out.position.z - front)/1000); return Out; }
float4 mainPS (VS_OUT In) : COLOR0 { return In.depth; }
technique depth { pass p0 { VertexShader = compile vs_2_0 mainVS(); PixelShader = compile ps_2_0 mainPS(); } }
there may be other, better approaches of course
|
|
|
|