New answers tagged hlsl
I do recommend this link for examples: http://www.codesampler.com/dx9src/dx9src_8.htm#dx9_hlsl_fx_simple For those wondering why their code won't work, or if you're confused on how to incorporate the shader into your pipeline, this is a good place to go.
I'm not using DDSTextureLoader() functions myself, but it seems that the function creates appropriate shader resource view for you to match the DDS format and the associated sRGB space, thus you get about the same linearized result in the shader regardless if you use sRGB format in your DDS file or not. You could create your own SRV instead with fixed sRGB ...
What you essentially want is the depth in camera coordinates, but relative to model, not camera. the easiest way to achieve that is to calculate the position of the origin of a model coordinate system in camera coordinates. ... vec4 cs_position = glModelViewMatrix * gl_Vertex; vec4 origin_position = glModelViewMatrix * vec4(0,0,0,1); distToOrigin = ...
calculate a bounding volume of the object (sphere, convex hull, box - depends on your speed/accuracy needs), this needs to be done only once - at initalization while rendering, for each object: transform camera (origin, direction) to object space project bounding volume on camera direction axis and subtract camera origin projection to retrieve min/max ...
This is my fault - the 0 values are caused by a bug in RenderDoc v0.20 - the x0 indexable temp register being used there which contains your kernel data wasn't implemented in the shader debugging at the time of that release - I implemented it a few months ago. I'm hoping to get v0.21 with all the latest fixes out this week-ish.
Top 50 recent answers are included