RenderMan & RISpec >> Shading and sampling

by haggi krey » Sat, 19 Apr 2008 06:52:57 GMT

Hi,

I'm still try to understand how shading and sampling is done in
renderman compliant renderers. If someone could give me some additional
insight I'd be very happy.


From what I could read is that:

- a geometry is divided into a micropolygon grid
- shading is done at the vertices of the micropolygons
- then the sampling collects the shading samples of all x,y neighboring
pixels and combine them via a filter into the final pixel
- at the end, the pixels are filtered with a xyz filter

Okay. This mean if I have a high frequency texture where I need more
shading samples I need more micropolygon vertices. This can be archived
via a lower shading rate. This way I get a smoother result.

And because all shading samples in the x/y area for filtering have to be
in memory until the final pixel is done, I need more memory if I
increase samples in x and y.

Is this correct, more or less?

If yes, I have a question:

I did some simple tests with AIR and mayaman.

- If it is true that the renderer creates more micropolygons with a
lower shading rate, why does my rendering take almost the same memory if
I have a shading rate of 8 or .1?

Thanks

haggi

RenderMan & RISpec >> Shading and sampling

by Moritz » Mon, 21 Apr 2008 20:02:27 GMT


oin Haggi,


RMan compliance only means that the renderer implements a certain set
of required capabilities and exposes them through the RI API (http://
en.wikipedia.org/wiki/RenderMan_Interface_Specification).
RMan compliance does, however, say nothing about the underlying
algorithms used.

You could e.g. slap the RMan API in front of a renderer like VRay and,
if it supported all required capabilities, it could call itself
"RenderMan-compliant".

You are probably thinking about an implementation that is prominent
with RMan-compliant renderers, namely the REYES algorithm (http://
en.wikipedia.org/wiki/Reyes_rendering).

However, some of them (e.g. Pixie & 3Delight with some non-default
hiders or AIR) use completely different approaches. Blue Moon
Rendering Tools, the first freely available RMan implementation was a
pure ray-tracing renderer (http://en.wikipedia.org/wiki/BMRT).

REYES is also found in many other renderers these days, e.g. Modo's
built-in renderer, Poser's Firefly, the Pixels3D renderer and
Houdini's Mantra are all REYES renderers, even though none of them is
RMan-compliant.


I urge you to read "How PhotoRealistic RenderMan works" which is a
SIGGRAPH course note that became a chapter of the book "Advanced
RenderMan" (ARMan) and is freely available for download here
http://www.renderman.org/RMR/Publications/infbeyond.pdf


Not exactly. The shading samples are, as you said, the vertices of the
u-polys. The renderer then "shoots" samples through the u-polys under
the pixel in question. These samples will intersect the u-polys at
arbitrary places, not neccesarily at the vertices (which is where the
shading samples took place).
The shading at those pixel sample positions is interpolated from the
vertices of the resp. u-poly (unless you turn smooth shading off, then
each u-poly gets only a single color).


I'm not sure what you mean by a 'xyz filter'.
The pixel samples within the region specified by filter size are
averaged using a weighting fuction that is specified through the pixel
filter. This happens in 2D (the image), not in 3D.


Yes, but if your u-polys get considerably smaller than a pixel you
also need more pixel samples to account for geometric aliasing.
A good rule is a shading rate of 1 for a 2k frame. If your textures
are too blurry, you can tweak the texture filter used during texture
lookup. This includes both the filter used and the filter size.
Decreasing this will introduce some aliasing but give you crisper
result with the need to lower shading rate (which is much more
expensive).
In general, doing this only for the displacement texture solves most
issues that upset artists. :)


Yes, but this is negligible.


Afaik, AIR is not REYES renderer.
I might be completely off here but as far as my understading goes, AIR
uses foremost curvature-based tesselation criteria and then creates
shading samples in pixel space instead of shading at u-poly vertices.
So AIR works very different from the way described above.

Try setting shading rate to 10 in AIR, then run the same RIB through
3Delight, Aqsis or PRMan.
AIR's image will look like you ran a mosaic filter on it in Photoshop.
The images created by the other renderers will still look reasonably
good (definitely for lighting previews), only the shading will be
blurrier. Silhoutte quality will definitely be very good still since a
shading rate of 10 results in a u-poly edge length of only a

RenderMan & RISpec >> Shading and sampling

by haggi krey » Wed, 23 Apr 2008 05:50:43 GMT

Hi Moritz,

thanks a lot for this detailed explanation. That was really hepful.
I wasnt aware that reyes renderer are so different in their sampling
approaches.


Not exactly. Its the same effect like in 3delight. The textures are
blurry (AIR blurryness looks better than 3dlight blurryness ;) ),
silhuette is not affected at all by the shading rate even by extrem
insane values.


Shouldnt I see geometry artefacts if I increase the shading rate to,
lets say 100? I couldnt see any geometry edges, AIR or 3delight.


That would mean shading rate in AIR is a multiplicator for pixel samples?

Thanks again

haggi

RenderMan & RISpec >> Shading and sampling

by Moritz » Fri, 25 Apr 2008 22:00:29 GMT

Haggi,


that is interesting because the AIR manual, on page 31, shows a very
blocky image of a scene rendered with a shading rate of 4. Maybe Scott
needs to update his manual if the renderer's behaviour/algorithm used
has changed here. :)


Well, 100 is still a u-poly edge length of 'only' 10 pixels. Pretty
close to what the Maya 'renderer' calls "production quality". ;)


Well, since you say shading rate has not the effect any more in AIR
that is decribved in the manual, I'm frankly not sure. I guess only
Scotte himself can shed some light on this. :)

Cheers,

Moritz

Similar Threads

1. is goraud shading darker than phong shading?

I have been testing some scanline shading of difefrent models. I implemented 
both phong and goraud shading, and see that phong is visibly brighter than 
goraud. At first I thought that is was an error.. then after debugging for a 
while and seeing no errors (none that i recognized as errors), I thought 
that perhaps it was so.

The brightness is comming (in my test) from diffuse reflection and 
specularreflection. If a surface has a highlight, it can be located at an 
edge, a vertex or inside the surface. Given that the edge and vertices have 
as well as no area compared to the inside of the polygon, I reason that the 
highlight is mostly inside the surface.

An internal highlight will, with phong shading,  flood its light from the 
max-point out to the rest of the surface. The light will contribute with its 
maxvalue at some point.
With goraud shading will the vertices get some light intensity from the 
highlight, but it is smaller than the light that phong see in the surface. 
The vertices will then distribute this fainter light to the rest of the 
surface.

As I see it, this means that guraud is darker. Is this corrent?



2. Realtime shading example (uses time to shade)

3. Shading edges

Hi!

I'm quite new to dx programming so there might be an easy solution to
this.

Does directx have some kind of built in edge shading? What I mean is
that if I was to draw a cube, the renderer would draw black lines for
the (visible) edges of the cube, and apply som kind of shading on the
rest of the object. There would be some kind of angle threshold
between two triangles that would determine if their normals had too
wide an angle or not, and draw the line between them if the angle was
bigger than the threshold. Thus, a cube would have 12 edges are
targets for rendering, and the diagonals on each side would fall
outside the threshold and not be drawn.

Again, does directx support this kind of rendering?

If not, can anybody point me in the direction of some useful articles
or web pages?


Thanks!


- Peder -

4. Blending and shading 3D textured slices

5. Rotating a shaded object

Hello EveryBody,
I have a query.... actually i have a 3D mesh which i had to rotate and
also shade... for shading the mesh i used a vertex shader and a vertex
buffer.... the shader logic is in a .vsh file which is in assembly
language...
for shading the mesh .. i accessed the vertex buffer of mesh and also
the index buffer and then added a colour value to each vertex of the
mesh and then drew the mesh .. so now the mesh is shaded and drawn ...
but now i need to also rotate the mesh ... i tried rotating the mesh by
calling the D3DXMatrixRotationY() API but its not working ... also the
vsh file is in assembly language so can really understand ... is it
that rotation of a mesh is related to code in .vsh file ... i believe
the code in .vsh file is HLSL code ... but then how do i rotate the
mesh ... the contents of .vsh fiel are as follows


vs_1_1 // We're using vertex shader version 1.1

dcl_position v0 // We want the vertex position info to come in through
this register
dcl_color v1 // We want the color information to come in through this
register

// Transform the vertex coordinate with the transformation matrix
dp4 oPos.x, v0, c0
dp4 oPos.y, v0, c1
dp4 oPos.z, v0, c2
dp4 oPos.w, v0, c3

// We dont want to do anything to the color. Just pass it to the color
register.
mov oD0, v1


can somebody please help me with this ??
Thanks a lot for atleast trying to help me 
Thanks and Regards
Pooja

6. Bump Map Bad Shading? (Using DotProduct3)

7. Shading Probs With DirectX 7

I am working on a project that requires DX7.  My problem is this.  I
have a model exported from Max 6.  If I view that model in Viewer (
which does not include the textures ) the gouraud shading works fine
with a point light.  When I try and do the same in my code with the
object textured the object looks like it is trying to work but I get
facets which are wrong.  In fact most of it is wrong I seem to get
solid dark facets and some even 1/2 dark 1/2 light.  I hope someone
can help me on this.  I also assume the vertex normals are fine due to
the fact that viewer did a good job on the gouraud shading of the same
object.

8. Quick Shading Question