Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 08 Jul 2008
Offline Last Active Jul 28 2016 08:13 AM

#4959536 Remeber state of pixel in HLSL.

Posted by on 16 July 2012 - 04:57 AM

guess you could also solve it via stencil buffer. If pixel does not change, clip it, otherwise write one (or something else) in there. You can then use the stencil buffer to mask out only the changed/unchanged pixels.

#4927824 Atmospheric scattering

Posted by on 03 April 2012 - 03:22 AM

I have done something similar for my master thesis. Maybe this helps you out:

#4909537 Bruneton's atmospheric scattering demystified

Posted by on 04 February 2012 - 09:11 AM

I decided to take a closer look at atmospheric scattering in my master thesis. I guess everyone who is interested in this kind of topic once stumbled over Bruneton's precomputed atmospheric scattering model (paper found here), as it is considered the most accurate and realistic scattering model to date. While the paper itself is really good, its a bit short and only introduces the general idea (as most papers do). Although, Bruneton provides the associated source code on his homepage, many people (including me) had problems understanding how it really works. I dont know how many hours (or even days) I was sitting in front of some equations trying to figure out what they are supposed to do.

Fortunately, many people on this forum helped me in understanding the code and therefore I want to give something back to the community by sharing my master thesis which is called "Deferred Rending of Planetary Terrains with Accurate Atmospheres". It can be found on my homepage (direct link can be found here).

In my thesis I was really trying to explain all the tricky parts of Bruneton's scattering model in an "easy" way and to create a document, I wished to have back then. I guess this is also the reason, why it reads almost like an tutorial, rather than an academic work.

In this way I want to thank again the community for helping me during my studies. I really hope my thesis will prove useful to many of you. Last but not least, some screenshots of my results (video can be found here)


#4882929 [D3D9] Deferred Rendering: Point Lights (includes PICTURES)

Posted by on 11 November 2011 - 07:59 AM

have a look at catalins xna blog here

i also made my baby-steps in deferred rendering based on his tutorial and it's really well written and rather easy to understand

#4880055 Depth of Field (GPU Gems 3) Problems

Posted by on 03 November 2011 - 02:59 AM

finally found the problem:

there is a mistake in the bias term (which is stated in the GPU Gems article - also found this mistake in a siggraph presentation!)

instead of this:

 CoCBias = (aperture * focallength * (znear - planeinfocus)) / ((planeinfocus * focallength) * znear)

you have to use this:

CoCBias = (aperture * focallength * (znear - planeinfocus)) / ((planeinfocus - focallength) * znear)

hope this helps others too

#4798197 3D Texture Render Target?

Posted by on 13 April 2011 - 05:44 PM

it is actually not that difficult. First you have to create the texture (i hope its pretty selfexplanatory)

	ID3D10Device* pDevice = Renderer::getInstance()->getDevice();

	ID3D10Texture3D* colorMap = 0;

	D3D10_TEXTURE3D_DESC texDesc;
	texDesc.Width 	= _width;
	texDesc.Height	= _height;
	texDesc.Depth  	= _depth;
	texDesc.MipLevels = 0;
	texDesc.Format	= _colorFormat;
	texDesc.Usage      	= D3D10_USAGE_DEFAULT;
	texDesc.CPUAccessFlags = 0; 

	HR(pDevice->CreateTexture3D(&texDesc, 0, &colorMap));

	HR(pDevice->CreateRenderTargetView(colorMap, 0, &m_colorMapRTV));
	HR(pDevice->CreateShaderResourceView(colorMap, 0, &m_colorMapSRV));

	buildViewport(_width, _height);

when writing to the texture you have to choose the layer via a geometry shader - for example in c++ code you have something like that

	for (unsigned int layer = 0; layer < RES_DEPTH; ++layer) 
		shader->setInt("g_layer", layer);

then the geometry shader chooses the specific layer

	float4 posH   	: SV_POSITION;
	float2 texC		: TEXCOORD;
	uint   layer 		: SV_RenderTargetArrayIndex;

void GS_SetLayer(triangle VS_OUT input[3],
		inout TriangleStream<GS_OUT_LAYER> triOutputStream)
	GS_OUT_LAYER output;
	for(int i=0; i < 3; ++i)
		output.posH  = input[i].posH;
		output.texC  = input[i].texC;
		output.layer = g_layer; 

Important is the system-value semantic SV_RenderTargetArrayIndex which chooses the slice/layer in depth to which the pixel shader writes.

hope this helps!

#578866 D3D10: how to increase maxcount of SV_ClipDistance?

Posted by on 06 August 2010 - 02:57 AM

i would need more than 2 clipping planes in my vertex shader, but if I am trying to declare something like "float plane2 : SV_CLIPDISTANCE2;" in my vertex-output-struct, it results in an error saying: "invalid output semantic 'SV_CLIPDISTANCE2': Legal indices are in [0,1]".

So i read in the directx docs that you can increase these value but i dont understand how this can be accomplished:

doc says: "The combined clip and cull distance values are at most D3D#_CLIP_OR_CULL_DISTANCE_COUNT components in at most D3D#_CLIP_OR_CULL_DISTANCE_ELEMENT_COUNT registers.
Writable in the Vertex and Geometry shaders."

how exactly can I write these values in vertex shaders?

any help is appreciated!