Tag Info

New answers tagged

1

You don't specify what rendering method you want to use. Standard rasterisation of a 3D mesh? Or do you have a volume representation of the model and your renderer uses that directly? If you render a volume, check this: http://http.developer.nvidia.com/GPUGems/gpugems_ch39.html especially 39.2. The effect in the picture you provide is mainly subsurface ...


0

That is explained here by Shawn Hargreaves, the Xna lead coder http://blogs.msdn.com/b/shawnhar/archive/2010/04/05/spritebatch-and-custom-shaders-in-xna-game-studio-4-0.aspx


0

tex2D(g_SamplerShadowMap, vShadowMapUV).r should get you the depth value, in case your sampler, and texture are set up and bound correctly.


0

In the SpriteEffect source, the world matrix is actually float4x4 MatrixTransform


0

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.


0

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 ...


2

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 = ...


1

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 ...



Top 50 recent answers are included