Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 09 Aug 2009
Offline Last Active Jun 23 2015 11:51 AM

Topics I've Started

Pure device question

15 January 2013 - 07:01 AM

Hi all,

DirectX documentation says that GetRenderState() and some other functions don't work when device is created as pure. It also says that pure device doesn't filter redundant states. But it seems that all GetRendersState functions work correctly when I create device as pure. I don't get any errors in debbug output when using these functions on pure device. Also I get warnings of dx ignoring setting redundant states. Why is this so? I use ATI Radeon HD 5770.


Frustum clipping - depth interpolation

12 December 2012 - 01:23 PM


I have implemented a software rasterizer for occlusion culling. However, In some cases I get strange depth map results when polygons get clipped by frustum, especially when clipped by near plane. I am clipping points in homogenous coordinates (before w division) using -w <= x,y,z <= w.
Point interpolation along the edge (for near plane) is done like this:

newPoint = p1 + (p2-p1) * t;


t = (-p1.w - p1.z) / (p2.z - p1.z + p2.w - p1.w);

Depth map with wrong depth interpolation is in the attachment.

Does anybody know what is wrong here?


Shadow mapping on parallax surfaces

06 June 2012 - 04:13 PM


I want to get rid of the floating shadows on parallax surfaces by offsetting position. What is the best way to do it? I tried something like: NewPos = Pos + Normal * Height and it works fine when surface is viewed head-on (shadows are distorted across parallax surface), but when its viewed from side I get floating shadows. How can I get rid of them?



17 May 2012 - 05:46 PM

Hi everyone,

I have a few short questions about PCF. I have read many articles and forum topics about this but couldnt find clear answers.
So here are the questions:

1. Can hardware PCF be done in DirectX 9 by using D24X8 depth stencil buffer as texture, and if so, will it work on both ATI and Nvidia cards (which support DST) ?

2. Do you need to use tex2Dproj() function for it, or any texture fetch function will do the job?

3. If you need to use tex2Dproj(), how can one calculate correct shadow coordinates for cascades?

I have working CSM in DirectX, but I am not satisfied with averaging 3x3 depth compare tests to blur the edges. So, I tried using D24X8 depth buffer for my shadow map and 4 sample fetches with tex2Dproj. I keep getting strange projection (shadow map moves with camera and alike) but it seems that HW PCF is really there because shadows look much softer. I can post some code and pictures if someone wants.

Any help will be appriciated.
Sorry for my english and thanks!

Lens flare occlusion test problem

11 January 2011 - 08:25 AM

I am rendering sun flare as a post process and everything works fine in windowed mode. Occlusion test of flare happens after entire scene has been rendered and I fetch results in the next frame. When I switch to full screen, flare (at some camera angles when large portion of terrain is visible) doesnt get rendered, even if sun is visible. Occlusion test works fine, or other objects would be messed up as well...I use same device settings (resolution, buffer formats...) for both windowed and full screen mode. One more thing is interesting...While I am moving camera in space then everything is fine, as soon as I stop lens flare disappears.

I cant see how either of these three things (window mode, camera movement and terrain occlusion culling) are related to lens flare rendering and maybe they are not at all. I have spent 4 days on this without getting any closer to solution, so if anyone can think of something, I would be grateful.