Ignore:
Timestamp:
03/02/07 19:07:56 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/Demo/parallax.hlsl

    r2152 r2186  
    1717                         (T2 * Binormal - BT * Tangent)/det,  
    1818                         Normal/N2 ); 
    19 /*                                                       
     19                                                         
    2020        // simplified solution 
    21         return float3x3(Tangent/T2, Binormal/B2, Normal/N2);  
    22 */ 
     21        //return float3x3(Tangent/T2, Binormal/B2, Normal/N2);  
     22        // more simplified solution 
     23        //return float3x3(Tangent, Binormal, Normal); 
    2324} 
    2425 
     
    5253} 
    5354 
    54 float2 PARALLAX_MAPPING_ITER(sampler2D heightMap, float3 TexCoord, float3 View) 
     55float2 PARALLAX_MAPPING_OFFSET_LIMIT(sampler2D heightMap, float2 TexCoord, float3 View) 
     56{ 
     57    float4 Normal = tex2D(heightMap, TexCoord); 
     58    float h = Normal.a * HEIGHT_SCALE + HEIGHT_BIAS; 
     59    return TexCoord + h * View.xy; 
     60} 
     61 
     62float2 PARALLAX_MAPPING_ITER(sampler2D heightMap, float2 TexCoord, float3 View) 
    5563{ 
    5664    for(int i = 0; i < PARALLAX_ITERATION; i++) { 
    5765                float4 Normal = tex2D(heightMap, TexCoord); 
    5866                float h = Normal.a * HEIGHT_SCALE + HEIGHT_BIAS; 
    59                 TexCoord += (h - TexCoord.z) * Normal.z * View; 
     67                TexCoord += h * Normal.z * View; 
    6068        } 
    6169        return TexCoord.xy; 
     
    8189      
    8290    // performing parallax mapping 
    83     float2 ParallaxTex = PARALLAX_MAPPING_ITER(BumpMapSampler, float3(IN.TexCoord, 0), tView); 
     91    float2 ParallaxTex = PARALLAX_MAPPING_ITER(BumpMapSampler, IN.TexCoord, tView); 
    8492        DISCARD_BY_TEX(ParallaxTex); 
    8593         
Note: See TracChangeset for help on using the changeset viewer.