Tag Info

Hot answers tagged

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

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


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



Only top voted, non community-wiki answers of a minimum length are eligible