State of Fortune

Nice! Now just to get the correct distance from the depth map (seeing as it isn’t linear based on the perspective). I’ll have a look at it. Thanks!

Mike

Thanks for the medal, but after re-thinking about the idea I purposed, I realized it won’t find the depth of the water that directly beneath the “camera ray”-“water surface” intersection. :frowning: (I guess that is what you really want to determine where to have animated white foam)

Anyway I enjoyed the sandbox environment you created, it definitely takes more skills to construct stuff in state of fortune than in Minecraft. One thing i have noticed (not sure if it’s a bug or not) is that things disappear under the water when you turn the reflection on. I can still see the bottom of the water though.

Kudos for the ASCII art, but you need to take refraction into account, as water has a significant refractive index, and not the least of which means if you’re looking at the water’s surface at an angle below the angle of total internal reflection (Fresnel angle I think it’s called?), it’s 100% reflective. The math for this is not anything I could tell you off the top of my head, but googling for “shader water refraction” should turn up a solution or two.

Snell’s Law gives the angle of refraction based on the angle of incidence.
n1 * sin(thetain) = n2 * sin(thetaref)
where n1 would be 1 for air, and n2 would be ~1.33 for water.

This is not about rendering or physics, but about determining the depth of the water for each water fragment from a previously rendered depthbuffer of the ground. Refraction is irrelevant in this context. After thinking about it, it simple seems not feasible. Querying the heightmap (if the terrain uses one) again seems a better option…

Thanks for the medal, but after re-thinking about the idea I purposed, I realized it won’t find the depth of the water that directly beneath the “camera ray”-“water surface” intersection. :frowning: (I guess that is what you really want to determine where to have animated white foam)

Anyway I enjoyed the sandbox environment you created, it definitely takes more skills to construct stuff in state of fortune than in Minecraft. One thing i have noticed (not sure if it’s a bug or not) is that things disappear under the water when you turn the reflection on. I can still see the bottom of the water though.

Kudos for the ASCII art, but you need to take refraction into account, as water has a significant refractive index, and not the least of which means if you’re looking at the water’s surface at an angle below the angle of total internal reflection (Fresnel angle I think it’s called?), it’s 100% reflective. The math for this is not anything I could tell you off the top of my head, but googling for “shader water refraction” should turn up a solution or two.

Snell’s Law gives the angle of refraction based on the angle of incidence.
n1 * sin(thetain) = n2 * sin(thetaref)
where n1 would be 1 for air, and n2 would be ~1.33 for water.

This is not about rendering or physics, but about determining the depth of the water for each water fragment from a previously rendered depthbuffer of the ground. Refraction is irrelevant in this context. After thinking about it, it simple seems not feasible. Querying the heightmap (if the terrain uses one) again seems a better option…

Right, I can store the depth in the color buffer, but it will mean I need to add a lot of vertices (water is currently only a single quad) and that I need to add a bit of work. It’s doable in the long run but for now I guess I’ll have to be happy with the water as it is :slight_smile:

I didn’t do any work on it last week as I had a family vacation.

Mike

Right, I can store the depth in the color buffer, but it will mean I need to add a lot of vertices (water is currently only a single quad) and that I need to add a bit of work. It’s doable in the long run but for now I guess I’ll have to be happy with the water as it is :slight_smile:

I didn’t do any work on it last week as I had a family vacation.

Mike

You probably would “only” need to render the terrain of the frustum from above in a separate pass and store the elevation in an FBO. Then again you can just compare the water fragment coordinates to that.

You probably would “only” need to render the terrain of the frustum from above in a separate pass and store the elevation in an FBO. Then again you can just compare the water fragment coordinates to that.

A nice milestone! The shader, rendering the world in stereoscopic 3d and the movement of your head with the oculus rift is now all working :slight_smile: There are lots of smaller things left to fix, but it is already awesome to walk around in a game I created myself!


http://stateoffortune.com/pictures/screenshots/Rift.png

Mike

Now that sir, is Awesome! :o

Have a medal.

A nice milestone! The shader, rendering the world in stereoscopic 3d and the movement of your head with the oculus rift is now all working :slight_smile: There are lots of smaller things left to fix, but it is already awesome to walk around in a game I created myself!


http://stateoffortune.com/pictures/screenshots/Rift.png

Mike

Now that sir, is Awesome! :o

Have a medal.

To do this stereoscopic 3D, do you have to render the world twice, one at each eye’s position?

Indeed. It is possible to do it based on the depth buffer but from what I’ve heard it looks way worse.

Mike

To do this stereoscopic 3D, do you have to render the world twice, one at each eye’s position?