unintuitive shader rendering

32 views
Skip to first unread message

Loïc Fejoz

unread,
Nov 30, 2013, 12:12:08 PM11/30/13
to ic...@googlegroups.com
Hi,

I've tried a simple shader that, as said somewhere in the document, return -1 so as to carved a box.

This shader shall render a part of a cylinder. When sliced it seems correct but otherwise the rendering provides a non intuitive feedback of what the final piece will be...

int material(vec3 p,int groups)
{
  if ( in_group(0) ) {
    if ((p.x*p.x+p.y*p.y) < 1) {
        return 0;
    }
  }
  return -1;
}

Thanks.

Regards,
Loïc
stange-shader-result.png
stange-shader-result-sliced-correct.png

sylefeb

unread,
Dec 1, 2013, 7:45:15 AM12/1/13
to ic...@googlegroups.com
Hi Loic,

Great to know you are looking into this ; shaders are a very unique feature of IceSL :-)

When shaders are used to carve, there is unfortunately no easy way for us to do the interactive rendering. The reason is that shaders are applied to the slice, and during on screen rendering the slices do not exist.
This is why the rendering uses the checkerboard: To warn you that what you see is not the final result. After slicing, the paths are correct.

This is I think explained in the documentation, but an example such as yours above would be a great addition.

In the future, we could provide a 'slice explorer' tool, which would be a plane that you can move throughout the object to see the actual slice outline. Maybe we can do better, I'll try to give it more thoughts, but so far all solutions I can think of would require a couple seconds to render on screen.

Loïc Fejoz

unread,
Dec 1, 2013, 3:35:28 PM12/1/13
to ic...@googlegroups.com
Hi,

Ok but they are still applied on faces?

PS: I think I got tricked by my formula not being tangential on front face.

sylefeb

unread,
Dec 1, 2013, 5:34:10 PM12/1/13
to ic...@googlegroups.com
At the slice level the notion of 'face' does not really exists. The slice is an image where each pixel is the group bitfield (and 0 means empty). The shader is applied to this image.

During rendering the shader is applied to the geometry -- this is just for visualization and indeed quickly gets confusing when using carving from the shader.
Reply all
Reply to author
Forward
0 new messages