Jump to content
  • Advertisement
Sign in to follow this  
xujiezhige

ParallaxOcclusionMapping intersection point calculation

This topic is 2477 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

If you have seen the codes of ParallaxOcclusionMapping sample in DX9. You may know the ray-height profile intersection calculation.
I get my result, but is good in running.
Please give me some cues of how to comprehend it.

[color="#000000"]pt1 [color="#666600"]=[color="#000000"] float2[color="#666600"]([color="#000000"] fCurrentBound[color="#666600"],[color="#000000"] fCurrHeight [color="#666600"]);[color="#000000"]
pt2 [color="#666600"]=[color="#000000"] float2[color="#666600"]([color="#000000"] fCurrentBound [color="#666600"]+[color="#000000"] fStepSize[color="#666600"],[color="#000000"] fPrevHeight [color="#666600"]); [color="#000088"]float[color="#000000"] fDelta2 [color="#666600"]=[color="#000000"] pt2[color="#666600"].[color="#000000"]x [color="#666600"]-[color="#000000"] pt2[color="#666600"].[color="#000000"]y[color="#666600"]; [color="#000088"]float[color="#000000"] fDelta1 [color="#666600"]=[color="#000000"] pt1[color="#666600"].[color="#000000"]x [color="#666600"]-[color="#000000"] pt1[color="#666600"].[color="#000000"]y[color="#666600"]; [color="#000088"]float[color="#000000"] fDenominator [color="#666600"]=[color="#000000"] fDelta2 [color="#666600"]-[color="#000000"] fDelta1[color="#666600"];[color="#000000"]

fParallaxAmount [color="#666600"]= [color="#666600"]([color="#000000"] pt1[color="#666600"].[color="#000000"]x [color="#666600"]*[color="#000000"] fDelta2 [color="#666600"]-[color="#000000"] pt2[color="#666600"].[color="#000000"]x [color="#666600"]*[color="#000000"] fDelta1 [color="#666600"]) [color="#666600"]/[color="#000000"] fDenominator[color="#666600"];


Share this post


Link to post
Share on other sites
Advertisement

[color="#000000"]pt1 [color="#666600"]=[color="#000000"] float2[color="#666600"]([color="#000000"] fCurrentBound[color="#666600"],[color="#000000"] fCurrHeight [color="#666600"]);[color="#000000"]
pt2 [color="#666600"]=[color="#000000"] float2[color="#666600"]([color="#000000"] fCurrentBound [color="#666600"]+[color="#000000"] fStepSize[color="#666600"],[color="#000000"] fPrevHeight [color="#666600"]); [color="#000088"]float[color="#000000"] fDelta2 [color="#666600"]=[color="#000000"] pt2[color="#666600"].[color="#000000"]x [color="#666600"]-[color="#000000"] pt2[color="#666600"].[color="#000000"]y[color="#666600"]; [color="#000088"]float[color="#000000"] fDelta1 [color="#666600"]=[color="#000000"] pt1[color="#666600"].[color="#000000"]x [color="#666600"]-[color="#000000"] pt1[color="#666600"].[color="#000000"]y[color="#666600"]; [color="#000088"]float[color="#000000"] fDenominator [color="#666600"]=[color="#000000"] fDelta2 [color="#666600"]-[color="#000000"] fDelta1[color="#666600"];[color="#000000"]

fParallaxAmount [color="#666600"]= [color="#666600"]([color="#000000"] pt1[color="#666600"].[color="#000000"]x [color="#666600"]*[color="#000000"] fDelta2 [color="#666600"]-[color="#000000"] pt2[color="#666600"].[color="#000000"]x [color="#666600"]*[color="#000000"] fDelta1 [color="#666600"]) [color="#666600"]/[color="#000000"] fDenominator[color="#666600"];


Share this post


Link to post
Share on other sites

pt1 = float2( fCurrentBound, fCurrHeight );
pt2 = float2( fCurrentBound + fStepSize, fPrevHeight );

float fDelta2 = pt2.x - pt2.y;

float fDelta1 = pt1.x - pt1.y;

float fDenominator = fDelta2 - fDelta1;

fParallaxAmount = ( pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;

Share this post


Link to post
Share on other sites
If you have seen the codes of ParallaxOcclusionMapping sample in DX9. You may know the ray-height profile intersection calculation.
I get my result, but isn't good in running.
Please give me some cues of how to comprehend it.


pt1 = float2( fCurrentBound, fCurrHeight );
pt2 = float2( fCurrentBound + fStepSize, fPrevHeight );

float fDelta2 = pt2.x - pt2.y;

float fDelta1 = pt1.x - pt1.y;

float fDenominator = fDelta2 - fDelta1;

fParallaxAmount = ( pt1.x * fDelta2 - pt2.x * fDelta1 ) / fDenominator;

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!