Ignore:
Timestamp:
06/06/07 19:19:29 (17 years ago)
Author:
szirmay
Message:
 
File:
1 edited

Legend:

Unmodified
Added
Removed
  • GTP/trunk/App/Demos/Illum/Ogre/Media/materials/GTPPathMap/PathMapWeightCompute.hlsl

    r2409 r2417  
    3232    vsOutputComputeWeights output = (vsOutputComputeWeights)0; 
    3333    output.pos = input.pos; 
    34     output.tex = (input.pos + 1.0) / 2.0; 
     34    output.tex = (input.pos.xy + 1.0) / 2.0; 
    3535    //output.tex = input.tex; 
    36    // output.tex.y = 1.0 - output.tex.y; 
    37     input.pos.y *= -1; 
     36    output.tex.y = 1.0 - output.tex.y; 
     37    //input.pos.y *= -1; 
    3838    
    3939    return output; 
     
    9595{ 
    9696        float dataColumnWidth = 1.0 / (float)nRadionColumns; 
    97         int bushIndex = input.tex.x * 4096 + input.tex.y * nRadionColumns * 4096; 
     97/*      int bushIndex = input.tex.x * 4096 + input.tex.y * nRadionColumns * 4096; 
    9898        int werx = bushIndex % nRadionColumns; 
    9999        int wery = bushIndex / nRadionColumns; 
    100100        float3 pos = tex2D(radionSampler, float2((werx + 0.25) * dataColumnWidth, (wery  + 0.5) / 4096.0) ).xyz; 
    101         float3 dir = tex2D(radionSampler, float2((werx + 0.75) * dataColumnWidth, (wery  + 0.5) / 4096.0) ).xyz; 
     101        float3 dir = tex2D(radionSampler, float2((werx + 0.75) * dataColumnWidth, (wery  + 0.5) / 4096.0) ).xyz;*/ 
     102        float3 pos = tex2D(radionSampler, float2(input.tex.x + 0.25 * dataColumnWidth, input.tex.y  + 0.5 / 4096.0) ).xyz; 
     103        float3 dir = tex2D(radionSampler, float2(input.tex.x + 0.75 * dataColumnWidth, input.tex.y  + 0.5 / 4096.0) ).xyz; 
     104//      float3 pos = tex2D(radionSampler, float2(0.25, input.tex.y  + 0.5 / 4096.0) ).xyz; 
     105//      float3 dir = tex2D(radionSampler, float2(0.75, input.tex.y  + 0.5 / 4096.0) ).xyz; 
     106         
    102107        dir = normalize(dir); 
    103108         
     
    115120        dist -= DIST_BIAS; 
    116121        visibility = (distNorm <= storedDist); 
    117            
    118         visibility = 1.0 + 0.00001 * visibility;                 
     122        //visibility = visibility * 0.0000001 + 1.0;   
    119123        visibility *=  1.0 / (lightAttenuation.y + dist * lightAttenuation.z + dist * dist * lightAttenuation.w); 
    120124         
    121125        float4 ret = visibility * cosb * lightPower * lightColor; 
     126         
     127        //ret = 0.00000001 * ret * nRadionColumns + (dist<25.0);//float4(pos,1);//input.tex.y * 4096.0; 
    122128        return ret; 
    123129} 
     
    137143        for(int i = 0; i < entryPointCount; i++) 
    138144        { 
    139                  
    140145                float dataColumnWidth = 1.0 / (float)nRadionColumns; 
    141146                int werx = currentEntryPoint % nRadionColumns; 
    142147                int wery = currentEntryPoint / nRadionColumns; 
    143                 float2 coord1 = float2((werx + 0.5) * dataColumnWidth, (wery  + 0.5) / 4096.0); 
     148                float2 coord1 = float2((werx + 0.5) * dataColumnWidth, (wery  + 0.5) / 4096.0);          
    144149                float2 coord2 = coord1 + float2(0.25 * dataColumnWidth, 0); 
     150                 
     151                //coord1 = coord1 * 0.00000001 + float2(0.5, (currentEntryPoint + 0.5)/4096); 
     152                //coord2 = coord1 + float2(0.25, 0); 
     153                 
    145154                float3 w = tex2Dlod(allWeightsSampler, float4(coord1, 0, 0)).rgb; 
    146                 float radrad = tex2Dlod(radionSampler, float4(coord2, 0, 0)).a;          
     155                float radrad = 1;// tex2Dlod(radionSampler, float4(coord2, 0, 0)).a;             
    147156                weight += w * radrad;            
    148157                clusterRad += radrad; 
     
    155164                weight = 0; 
    156165    
    157         return float4(weight, 1); 
     166        float4 ret = 0; 
     167        //if(abs(input.tex.x - 2*halfPixel*2)<halfPixel/2.0) 
     168                ret = float4(weight, 1);         
     169        return ret; 
    158170} 
    159171 
     
    162174                                                 uniform float4x4 worldViewProj, 
    163175                                                 out float4 hPos:POSITION, 
    164                                                  out float2 texCoord: TEXCOORD0) 
     176                                                 out float3 texCoord: TEXCOORD0) 
    165177{ 
    166         hPos = mul(worldViewProj, position); 
    167         texCoord = color.xy; 
     178        hPos = mul(worldViewProj, float4(position.x,0,position.z,1)); 
     179        texCoord = color.xyz; 
     180        texCoord = position.y; 
    168181} 
    169182 
    170 float4 EntryPointDisplayPS(float2 texCoord : TEXCOORD0, 
    171                                                         uniform sampler2D weightTexture : register(s0)):COLOR0 
     183float4 EntryPointDisplayPS(float3 texCoord : TEXCOORD0, 
     184                                                        uniform sampler2D weightTexture : register(s0), 
     185                                                        uniform sampler2D clusterWeightTexture : register(s1)):COLOR0 
    172186{ 
    173         //return texCoord.y; 
    174         return texCoord.r; 
     187        float entryPointID = (256.0f * texCoord.r * 256.0f + 256.0f * texCoord.g + 0.5) / 4096.0f; 
     188        entryPointID = texCoord.x; 
     189        //return float4(texCoord, 1); 
     190        //return tex2D(clusterWeightTexture, float2(0.5, 1.0 - ((entryPointID + 0.5 )/ 4096.0))); 
     191        return tex2D(weightTexture, float2(0.5, ((entryPointID + 0.5 )/ 4096.0))); 
     192        //return abs(tex2D(weightTexture, float2(0.5, ((entryPointID + 0.5 )/ 4096.0))) - entryPointID); 
     193        return entryPointID; 
    175194} 
    176195                                                          
Note: See TracChangeset for help on using the changeset viewer.