Jump to content

View more

Image of the Day

雑魚は多めにして、爽快感重視にしつつ・・・(´・ω・`)
早いとこ、ベースを作って、完成にもっていかないとね。
タイトルもまだ迷ってるだよなぁ。 
#indiedev  #indiegame #screenshotsaturday https://t.co/IwVbswGrhe
IOTD | Top Screenshots

The latest, straight to your Inbox.

Subscribe to GameDev.net Direct to receive the latest updates and exclusive content.


Sign up now

Parallax mapping

4: Adsense

Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.


  • You cannot reply to this topic
15 replies to this topic

#1 whathappened   Members   

122
Like
0Likes
Like

Posted 15 April 2006 - 01:18 AM

I dont really know if this topic fits into the DirectX forum but I hope so since it's about shaders. I just wonder, what is parallax mapping? I know how to make bump mapping and some displacement mapping (to actual change the geometry) but what is parallax mapping? Anyone who has a good link where it's explained cause I couldnt find one

#2 crazyishone   Members   

172
Like
0Likes
Like

Posted 15 April 2006 - 01:23 AM

Here

That gives a brief description of what parallax mapping is.


#3 sirob   Members   

1181
Like
0Likes
Like

Posted 15 April 2006 - 01:26 AM

Also, in case you are interested in an actual implementation, a Parallax Mapping sample has been recently added to the SDK samples. Grab the April '06 SDK to give it a go.

Hope this helps. :)

#4 whathappened   Members   

122
Like
0Likes
Like

Posted 15 April 2006 - 01:29 AM

thank you. Is there any tutorials available somewhere? I've only seen short descriptions when trying to google :(

#5 ET3D   Members   

810
Like
0Likes
Like

Posted 15 April 2006 - 12:21 PM

Don't know about a tutorial, but if you google "parallax mapping site:ati.com" you should find a couple of docs. ATI's March SDK contains an article about this.

#6 CadeF   Members   

421
Like
0Likes
Like

Posted 15 April 2006 - 03:39 PM

Its quite simple, actually. It only requires a heightmap texture for the shader pass.


float3 vEye = -TBNViewDir;
float fBumpScale = 0.05f;
float2 vCoord = texCoord;

float fDepth = tex2D(sHeightMapSampler, vCoord).w;
float2 vHalfOffset = normalize(vEye).xy * (fDepth) * fBumpScale;

fDepth = (fDepth + tex2D(sHeightMapSampler, vCoord + vHalfOffset).x) * 0.5;
vHalfOffset = normalize(vEye).xy * (fDepth) * fBumpScale;

fDepth = (fDepth + tex2D(sHeightMapSampler, vCoord + vHalfOffset).x) * 0.5;
vHalfOffset = normalize(vEye).xy * (fDepth) * fBumpScale;

return vCoord + vHalfOffset;


Then, sample the diffuse texture and the normal texture using the returned coordinates.

Basically, it samples the height map at the texture coordinate, and offsets the texture coordinates in the direction away from the viewer. I do 3 iterations to get good results. If you only do one, the effect is negligible.

In these 2 screenshots, I have doubled the parallax amount to make the difference clearly visible.


No parallax mapping


Parallax mapping

#7 jamesw   Members   

400
Like
0Likes
Like

Posted 15 April 2006 - 07:35 PM

Ah cool, I didn't think about multiple samples/calculations. Does that increase accuracy or create a larger offset?

#8 Armadon   Members   

1087
Like
0Likes
Like

Posted 15 April 2006 - 10:20 PM

Cadef, in the second screenshot if seems like your parallax mapping goes off to the left. Maybe a projection problem?

#9 CadeF   Members   

421
Like
0Likes
Like

Posted 16 April 2006 - 12:39 AM

Multiple samples increase accuracy. If you take 1 sample, it will look wrong.

It is supposed to go off to the left, that is parallax mapping. It might seem a bit wrong, because I exaggerated the parallax scale to make the effect prominent.

#10 whathappened   Members   

122
Like
0Likes
Like

Posted 16 April 2006 - 01:25 AM

So parallax mapping is just about the texture coordinates? Would be great with a little more detailed explanation :)

and does anyone know any links where I can find a simple texture and a nice parallax map to work with :)

[Edited by - whathappened on April 16, 2006 7:25:58 AM]

#11 ET3D   Members   

810
Like
0Likes
Like

Posted 16 April 2006 - 02:16 AM

Quote:
and does anyone know any links where I can find a simple texture and a nice parallax map to work with :)


The aforementioned SDK sample...

#12 godmodder   Members   

820
Like
0Likes
Like

Posted 16 April 2006 - 02:29 AM

www.ultimategameprogramming.com has a tutorial about parallelax mapping

#13 whathappened   Members   

122
Like
0Likes
Like

Posted 16 April 2006 - 02:37 AM

where on that page, the article list seems empty to me

#14 ET3D   Members   

810
Like
0Likes
Like

Posted 16 April 2006 - 02:44 AM

Yeah, that's one site I'm never going to visit again.

#15 CadeF   Members   

421
Like
0Likes
Like

Posted 16 April 2006 - 03:37 AM

Yes, parallax mapping is just about pushing texture coordinates away from the camera. How far it is pushed, depends on EyeVector * ParallaxMappingScale

#16 whathappened   Members   

122
Like
0Likes
Like

Posted 16 April 2006 - 03:59 AM

thanks :)




Old topic!

Guest, the last post of this topic is over 60 days old and at this point you may not reply in this topic. If you wish to continue this conversation start a new topic.