Announcement

Collapse
No announcement yet.

Render time / Raytraced booleans

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

  • Render time / Raytraced booleans

    I was playing with this idea of raytraced booleans. Basicly a material that checks if its in/outside certain objects to determine its opacity/visibility.

    Shouldn't be too hard to do something like this right? They only problem I can see is how to check if point is inside an object. Is there any usefull VRay raytracing function for this? (Tracing ray into random direction [0,0,1] and count number of intersection with the object, odd = inside, even = outside). The second would be feeding the list of objects to the material, I'm not quite sure how this could be done in VRay (maxsdk)?
    http://www.ylilammi.com/

  • #2
    You can use the findIntersection() function to find the first intersection, then you can call the same function for the next intersection and so on. There is similar code in the sources of the VRayDirt plugin (it is included with the V-Ray SDK which comes with the V-Ray installation) for dealing with transparent occlusion.

    Best regards,
    Vlado
    I only act like I know everything, Rogers.

    Comment


    • #3
      It would be pretty awesome if you could do something like this to get markings on a road (white lines, etc.). Just have the shape floating above it with an extrude modifier, hide it and render away.

      Comment


      • #4
        Yeah that shouldn't be that hard once I figure out the basics.

        I reconsider the idea of using material to achieve the boolean effect. Instead it would a lot wiser to use geometric primitive instead.

        The bolean primitive would have sub primitives (max objects) and then it would trace them when itself would be traced. However I'm not quite sure how to convert the sub objects into VRay.

        Lets say I have my boolean object that is native VRenderObject. Then it has sub objects, normal max objects/vray compatible objects/whatever. How would I convert them into GenericPrimitive so I could intersect them?

        - Jerry
        http://www.ylilammi.com/

        Comment


        • #5
          I think you need to write a material, not a geometric primitive...

          Best regards,
          Vlado
          I only act like I know everything, Rogers.

          Comment


          • #6
            Okey I'm now trying to make a texmap that results black or white depending how it intersects other objects. The problem is I still don't understand how I can compare GenericPrimitive* which is result of the intersection to see if its the same as INode* in my list. Obviously I need to do some typecasts but I'm not sure what I should cast into what.

            Thanks for you help Vlado.
            http://www.ylilammi.com/

            Comment


            • #7
              You can get a render ID from the INode class; you can compare this render ID against the one returned by the VRayShadeInstance class for the intersection point - see, for example, how this is done by VRayToon (sources are in the V-Ray SDK too).

              Best regards,
              Vlado
              I only act like I know everything, Rogers.

              Comment


              • #8
                Originally posted by duke2 View Post
                It would be pretty awesome if you could do something like this to get markings on a road (white lines, etc.). Just have the shape floating above it with an extrude modifier, hide it and render away.
                I'm pretty sure you can already do this with the vray dirt as it is now.

                edit:


                The material open in the mat editor there is the one for the base/ground. You could add a bitmap into the radius of this to add a natural erosion to the edges of the paint work, and put your vray dirt within the 'amount' slot of a mix material, giving you room to use textures for the road and lines. If you used different mapping ID's it could get fairly powerful, moreso when you start using the dirt within the reflection glossiness and displacement to seperate the two even more.
                Last edited by Neilg; 29-09-2008, 01:41 AM.

                Comment


                • #9
                  Nice! I thought about that but then I thought about the rendertimes and the possibly flickering/roughness of the edges but i'll have to experiment. It's pretty damn cool that you can do that though.

                  Comment


                  • #10
                    BoolTrace

                    Be sure to check out BoolTrace, which creates perfectly,
                    run-time cut geometry with MentalRay. The site of the author
                    is currently updated, so please check out this:

                    http://www.xsibase.com/forum/index.p...threadid=18180

                    Such a implementation for V-Ray would be amazing!

                    Best, Rob

                    Comment


                    • #11
                      Originally posted by cubiclegangster View Post
                      I'm pretty sure you can already do this with the vray dirt as it is now.

                      edit:


                      The material open in the mat editor there is the one for the base/ground. You could add a bitmap into the radius of this to add a natural erosion to the edges of the paint work, and put your vray dirt within the 'amount' slot of a mix material, giving you room to use textures for the road and lines. If you used different mapping ID's it could get fairly powerful, moreso when you start using the dirt within the reflection glossiness and displacement to seperate the two even more.
                      After tinkering a bit, the major problem with this is you can't choose what the dirt does and doesn't see, so wherever theres an object intersecting you'll have a road or whatever you're using it for.
                      Last edited by duke2; 08-10-2008, 10:50 PM.

                      Comment


                      • #12
                        It's been a while - anybody tried to implement Raytraced booleans?

                        Comment


                        • #13
                          Two 'good' ways of doing this.

                          1. I think the easiest way to create raytraced booleans would be creating a material that lets rays pass through or render the actual material based on the boolean logic.

                          2. More optimized and efficient way would be creating a geometric primitive which takes the operands as sub primitives and intersects them with the given ray and then returns the correct intersection based on boolean logic.

                          Both methods would use 1 extra ray per intersection to determine if intersection lies inside/outside all given operands.

                          One of the hardest part of this would be creating the interface.

                          I don't have good enough understanding of Vray's api to tell how hard to implement option #2 would be or if it could be even done.

                          Unfortunately I don't have enough time to code stuff like this for free at the moment.

                          - Jerry
                          http://www.ylilammi.com/

                          Comment

                          Working...
                          X