🎉 Celebrating 25 Years of GameDev.net! 🎉

Not many can claim 25 years on the Internet! Join us in celebrating this milestone. Learn more about our history, and thank you for being a part of our community!

Finished all open chapters!

Published July 16, 2008
Advertisement
Finally, I am done writing all of the chapters and articles that I had been committed to. The final one was pretty short notice, and since I was out of town on business I was cut a little short on time. Anyhow, the following image was generated during the writing of the article and I thought it was interesting enough to post here:



This is a parallax occlusion mapped cube, with the gridlines added programmatically in the pixel shader. It's a nice cue about where the surface is being distorted based on the parallax effects. The code is relatively simple as well, as shown in the following listing:

// Define the 'GRIDLINES' preprocessor directive to draw the gridlines// on the texture surface.  This helps visualization of the simulated surface//#define GRIDLINES#ifdef GRIDLINES	float2 vGridCoords = frac( vFinalCoords * 10.0f );	if ( ( vGridCoords.x < 0.025f ) || ( vGridCoords.x > 0.975f ) )		OUT.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );	if ( ( vGridCoords.y < 0.025f ) || ( vGridCoords.y > 0.975f ) )		OUT.color = float4( 1.0f, 1.0f, 1.0f, 1.0f );#endif

The idea is to multiply the current texture coordinates by the number of gridlines desired per wrapping of the texture. Then take the fractional portion of the result and compare it to a lower and upper limit, coloring if it falls outside of the given range. When working with POM it seems to help out quite a bit and it looks cool too!
Previous Entry Taking a trip
Next Entry Continuing Work
0 likes 1 comments

Comments

jollyjeffers
Neat trick.

What does the overall effect look like if you get the textures to match-up seamlessly on the edges of the cube? Looks to me like the only thing that breaks the illusion...

Jack
July 17, 2008 04:24 AM
You must log in to join the conversation.
Don't have a GameDev.net account? Sign up!
Advertisement