Announcement

Collapse
No announcement yet.

[Tutorial] Simple Cross Section Material

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • replied
    Well done.
    Would be quite handy for gore and similar features, if used right.

    Leave a comment:


  • replied
    very neat

    Leave a comment:


  • replied
    hey this is a nice resource
    but then again you can now see the inside of the mesh. what if you just scaled the vertices using worldpositionoffset instead of making them invisible? that way the chopped part would be flat at the section
    edit: oh well that would only scale verts, but here you have control of it by pixel.

    Leave a comment:


  • started a topic [Tutorial] Simple Cross Section Material

    [Tutorial] Simple Cross Section Material

    Greetings,

    I have recently tried to get the cross section of a skeletal mesh. The only solution I could find on the web was for Unity 3D (Link). In this solution he used a pixel shader to make everything on one side of the section invisible (alpha = 0). So I thought, this might also work with UDK Materials. This is what I came up with:



    The material is set as two sided and uses opacity mask and custom lighting.

    Opacity Mask:
    First I defined a parameter "plane_normalform". This is the hessian normal form of my cross section plane. Then I calculate the distance of World Position to this plane. This distance can be negative or positive, depending on which side of the plane World Position lies. If the distance is negative, I set opacity mask to 0 and therefore hide the pixel.

    Custom Lighting:
    I didn't want the back face to be affected by lighting, so I used custom lighting. The node "TwoSidedSign" tells us if we are dealing with a back face. Then I plug a constant color into custom lighting and 0 into custom lighting diffuse. This way the sectioned model doesn't look like a hollow body. If we are dealing with a front face, I use standard Phong shading.

    And now for the result. This is a model of a deer:



    And here the cross section is applied:

Working...
X