Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Aug 2012
Offline Last Active Oct 13 2014 03:39 PM

Topics I've Started

Shadow Mapping doesn't work in deferred renderer

10 October 2014 - 03:36 PM

Hey I have a problem implementing shadow mapping. For the shadow map I render a 512*512 pixel image from the view of the light. In the final shader I use the gbuffer and the shadow map to do these:

float2 projcoord;
	float mydepth;
	float lightdepth;
	float4 lightviewpos = mul(position,LightViewMatrix);
	lightviewpos = mul(lightviewpos,LightProjectionMatrix);

	projcoord.x = lightviewpos.x / lightviewpos.w / 2.0f + 0.5f;
	projcoord.y = -lightviewpos.y / lightviewpos.w / 2.0f + 0.5f;
	if( (saturate(projcoord.x) == projcoord.x) && (saturate(projcoord.y) == projcoord.y))
		mydepth = rsm_pos.Sample(pointSampler,projcoord).z / rsm_pos.Sample(pointSampler,projcoord).w; 
		lightdepth = lightviewpos.z / lightviewpos.w;
		lightdepth -= 0.001f;

		if( lightdepth < mydepth)
			return diffuse;

I don't know why it doesn't work, it seems to be right. Can somebody help me ?


Mixed resolution rendering nearest depth filter

19 September 2014 - 07:33 AM

Hey guys Iam trying to combine a lowres indirect illumination texture of 256x256 pixels with a 1024x1024 highres texture. I saw this article here : http://developer.download.nvidia.com/presentations/2010/futuregameon/LouisBavoil_ModernRealTimeRenderingTechniques.pdf


On page 20, a technique from a game is described to combine the lowres particels of the game with the fullres rendering. Well I implemented it the same way, but I don't get a realy good result. I use 4 samples which are defined like this : float2( tex.x - lowres_texel,tex.y ) , float2( tex.x + lowres_texel, tex.y) , float2( tex.x, tex.y + lowres_texel) , float2( tex.x, tex.y - lowres_texel), where tex is the texcoord of the current highres pixel and lowres_texel = 1/256.


Then I going through a for loop and combine the new depthdistance to the highresdepth with the previouse ones and save the index of the sample, which has the nearest depth of all. After that I look if the sample is in the range from 0-3( that would be the 2x2 samples, and  when -1 is sampled only with the standart texcoord tex) and output the color from this sample. 


How could I improve it ?? Because in the paper it works realy good 


Sample VPLs in Compute Shader

14 September 2014 - 07:11 AM

Hey guys I have a little blackout right now and I don't know why my code doesn't work. I try to optimize some GI stuff with Reflective Shadow Mapping with Computeshader and lowres filtering. In the first stage a computeshader samples the RSM and create a structured buffer with virtual point lights with the color,position and normal of the VPL. This is done by using 32 * 32 samples with 32 * 32 threads. But it seems in the result, that only the first row on the top of the image is captured and the other not....well this is the problem.


Here is the VPL code:

SamplerState samplerType : register( s0 );
Texture2D RSMColor : register( t4 );
Texture2D RSMNormal : register( t5 );
Texture2D RSMPosition : register( t6 );

struct VPL {
   float4 color;
   float4 normal;
   float4 position;

RWStructuredBuffer<VPL> VPLBuffer : register(u0);

#define NUM_X 32
#define NUM_Y 32


void CSMain(uint3 threadID : SV_GroupThreadID)
    VPL tmp;
    float2 texcoord;
    texcoord = float2(threadID.xy / 32.0f);
    tmp.color = RSMColor.SampleLevel(samplerType,texcoord,0);
    tmp.position = RSMPosition.SampleLevel(samplerType,texcoord,0);
    tmp.normal = RSMNormal.SampleLevel(samplerType,texcoord,0) ; 
    VPLBuffer[threadID.y * 32 + threadID.x] = tmp;

As you can see the VPLBuffer is filled with the VPL which is sampled using the threadID. The index is made of the two ids and the rowsize. My first idea was, that maybe I can't write to the VPLBuffer in a random order ( for example index 0 then index 10.....) but I'am not sure.

Thank you

Draw Textures as Lightflares

09 August 2014 - 05:07 PM

Hey guys Iam just wondering how to draw lightflare textures in a shader to the brightest specularreflection points. I think they are called anamorhic lightflares, something like that : http://img718.imageshack.us/img718/4577/screenshot0816.jpg


Iam not sure if it is done by just doing it like a bloom shader and just increase the number of samples in the horizontal way....I also saw people doing it with lightflare textures, positioning it to the brightest points of the image but how to do that within a shader ??

Thank you

Spherical harmonics in LPV

07 May 2014 - 08:02 AM

Hey guys I have a question about how Light propagation volumes works.Iam not shure what the function of spherical harmonics is because I dont understand what and what for it actually is. Can somebody explain what it is used for ? And also Iam wondering how the Volumen texture of "light" is aligned back to the geometry. Sorry Iam not very advanced in math because of my age.thanks