Jump to content
  • Advertisement


  • Content Count

  • Joined

  • Last visited

Community Reputation

208 Neutral

About StanIAm

  • Rank
  1. 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 ?  
  2. I got it work, but it still have some artifacts which looks not realy good. Look at the picture:    Now Iam using a 3x3 depth depth kernel but on some detailed geometry I still have artifacts. Has somebody an idea how to improve that ??
  3. 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  Thanks
  4. StanIAm

    Sample VPLs in Compute Shader

    Got it, the init UAV Buffer size was to small, now it works :)
  5. 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 [numthreads(NUM_X,NUM_Y,1)] 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
  6. 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
  7. StanIAm

    Spherical harmonics in LPV

    Hmm thanks for the answers now I got a better view on that stuff but some parts are still to difficult for me. In the paper above (http://www.cs.columbia.edu/~cs4162/slides/spherical-harmonic-lighting.pdf) I don't understand the stuff after the Monte Carlo Estimator. So you said SH "generates" a function that gives back in average the vectors for some input numbers ? And this is done by grabing some Basicfunctions ( I guess they are called coeffecients there ?? ) to store vectors for sphercial coordiates ?? This  reminds me to the hash tables where you have a hash function that gives you a position and thus the content for an input number.   But as I understand SH is only used to save memory. But how LPV would work withozt that Iam not shure how the principle works. I always think about a Volume texture in 3D space where the Start Lightpoints are registered via the RSM and then spread with each LPV iteration through the volume and then get sampled back to the geometry.....  I do not undersdtand that maybe someone can explain it better and particularly the sense of this Geometry Volume. Thanks     PS:agleed thanks for your explanation, one question are you german ? Because I live in Germany and it would be very nice when you could write in german 
  8. 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
  9. Hey guys I have a little question. I have a 256*256 texture for my indirect lighting and want to combine it with the full res rendering (1920*1080) that it looks okay. I tried to use a 3x3 gausian Blur but it still looks horrible. Here is the picture with the diffuse light + indirect Light*diffuse texture:  
  10. StanIAm

    RSM indirect Light flickering

    But when do I do that ? My first idea was the standart way of indirect lighting with RSM : Create Vector a = reflect( Lightposition - rsm pixel position, rsm pixel normal). Now vector a is the vector which is (maybe) directed to our dest pixel. Now I do nDotL with the dest pixels normal and vector a. Now I have to multiply this float with the rsm color and divide it by the fallof. But I don't realy unterstand what you mean with the binary test. Maybe someone can give me his way of implementing that, because I thing my way is too expensive.
  11. StanIAm

    RSM indirect Light flickering

    Oh thanks that makes sense. Well the double sided equation was my first idea of doing that. Is there an other way to do that ??
  12. Hey guys I have a little problem in my implementation of indirect illumination via Pixellights and RSM. The Problem is that when I move the light I can "see" the sampling points in the scene and it looks not so good. My implementation method is now: Render the RSM with 8*8 samples with a compute shader in a UAV and then in the final deferred shading pass sum the light influence from all 8*8 samples in each pixel. I use this formula: For one pixel: float3 irradiance = float3(0.0f,0.0f,0.0f); ... for(int i = 0; i < 8*8;i++) { irradiance += diffuse.rgb(the color map) * VPLBuffer.color.rgb(the sample color) * (saturate(dot(VPLBuffer.normal.xyz,position.xyz - VPLBuffer.position.xyz)) * saturate(dot(normal,VPLBuffer.position.xyz - position.xyz))) / pow(length(position.xyz - VPLBuffer.position.xyz),3); } .... return float4(diff + irradiance,1.0f); When I change the exponent of the pow function to 2 or 1 theflickering goes away, but then the light is reflected by a too big distance and it looks bad.... So how to filter that stuff ?? Here is a video of the problem I have and he/she solves it by an unknown filter.
  13. Hello I have a little question about the UAVs in directx. I read some explanations about UAVs but there are always 2 types of buffers for input and output in the examples. For my implementation I need a buffer that is only used in the shaders, so I use a pixel or compute shader to write to this buffer and in an other shader I want to read this data from it...so there is no need to manipulate the buffer in my c++ code. The problem is I saw in the tutorials that there are used 2 types of buffers, the StructuredBuffer as a ShaderResource and a RWStructuredBuffer as a UAV ( for output). My question is : why they use 2 buffers ?? Isn't it possible to create in  my c++ code the UAV -> set it to the pixelshader and that write in my first shader to it and then read it in my second pixel shader ??   Something like: //Create UAV ID3D11UnorderedAccessView* uav = .... ... m_pImmediateContext->PSSetUnorderedAccessViews( 0, 1, &m_destDataGPUBufferView, NULL ); Shader one: struct VPL { float3 pos; float3 norm; float3 flux; }; RWStructuredBuffer<VPL> buffer : register( u0 ); ... buffer[0].pos = float3(0.1f,0.5f,0.4f); Shader two: RWStructuredBuffer<VPL> buffer : register( u0 ); float3 pos = buffer[0].pos;
  14. StanIAm

    Increase texture reading speed

    Thank you very much for the answer. Your right it isn't very efficient when I use one 144 samples of a 1024*768 pixel rendered RSM... My idea would be to store the pixellights in an array structure with position/normal/flux so I have not to sample the points every pixel n times and have only a 1D array and only one for loop ( which I think doesn't really inscrease the speed...)  But storing the VPLs in a buffer would be more effecient I think but I have one problem with that. I don'T really know how to do that without a rendertarget...so only with a constantbuffer or any type of buffer. Is there a way to same the array of my pixellightstructure in a buffer and read it like a constant buffer in each frame ??
  15. Hello I have a question to you about some HLSL stuff.I implemented a global illumination compution with RSM and get with the cornell model and a 12*12 lightmap samples for each pixel a framerate of about 60 fps. That means I have to sample 3 textures ( diffuse/flux,position and normal, all R16G16B16A16_FLOAT format ) 144 times per pixel and that makes the computation slow. When I don't sample the textures and give them const values ( just for a test) I get avbout 800 FPS so this is a big difference. Now the question is how can I increase the speed of reading my textures to get a better speed ??  
  • 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!