sketchucation logo sketchucation
    • Login
    ℹ️ Licensed Extensions | FredoBatch, ElevationProfile, FredoSketch, LayOps, MatSim and Pic2Shape will require license from Sept 1st More Info

    Z-Depth gone crazy

    Scheduled Pinned Locked Moved V-Ray
    renderpluginsextensions
    18 Posts 4 Posters 1.6k Views 4 Watching
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • thomthomT Offline
      thomthom
      last edited by

      I was rendering out a test of my model - where I wanted to get a depth map.

      Render05.png

      I wanted to create a depth map so everything behind the building in the middle could be faded out by blurring based on depth. I measured and found the distance from the camera to the end of the building to be ca 4000 inches and about 18000 to the far back where you can see the church.

      So I set Black to 4000 and white to 18000. Ticking Z-Depth clamp.

      But the result was this:

      Black: 4000
White: 18000

      Why on earth is the foreground white? Surely this should be black as it's closer than 4000? And the sky should be white as it's in infinite distance away.

      I then reverted the values:

      Black: 18000
White: 4000

      I almost could have used this - expect, why is the sky white??

      I cannot remember running into this problem before... πŸ˜•

      Thomas Thomassen β€” SketchUp Monkey & Coding addict
      List of my plugins and link to the CookieWare fund

      1 Reply Last reply Reply Quote 0
      • thomthomT Offline
        thomthom
        last edited by

        So I placed a big plane in the far back - hoping that would catch the Z-Depth and make it black:

        Render06.ZDepth.png

        Not so. 😞 What gives?

        Thomas Thomassen β€” SketchUp Monkey & Coding addict
        List of my plugins and link to the CookieWare fund

        1 Reply Last reply Reply Quote 0
        • andybotA Offline
          andybot
          last edited by

          very odd. I did a quick check on a site model and it worked fine for me. Do you have the alpha channel selected as well? - I'm imagining that's why the background is black in the first image. Are you sure your values are correct for distance? Did you try lowering your foreground distance to 500" perhaps? Maybe your plane in the 2nd is getting clipped off the back.
          Another question - you could just export a sketchup fog style. I've done that for a quick z-depth pass. One advantage is you see the adjustment in real-time. Downside is that the control isn't very fine, but at this low bit-depth (256 levels for grayscale) it doesn't matter much.

          http://charlottesvillearchitecturalrendering.com/

          1 Reply Last reply Reply Quote 0
          • thomthomT Offline
            thomthom
            last edited by

            @andybot said:

            very odd. I did a quick check on a site model and it worked fine for me. Do you have the alpha channel selected as well?

            nope!

            @andybot said:

            • I'm imagining that's why the background is black in the first image.
              But why would the background flip around?

            @andybot said:

            Are you sure your values are correct for distance?

            Yup! I used my V-Ray Tools to measure points in the model from the camera - in inches. 4000 is right at the end of the building in the front - 18000 is right at the church.
            Distances.png

            @andybot said:

            Maybe your plane in the 2nd is getting clipped off the back.

            I've never seen V-Ray clip anything... πŸ˜• I even added that large plane even further in the back. It rendered in the diffuse - but didn't appear to make an effect in Zd.

            @andybot said:

            Another question - you could just export a sketchup fog style. I've done that for a quick z-depth pass. One advantage is you see the adjustment in real-time. Downside is that the control isn't very fine, but at this low bit-depth (256 levels for grayscale) it doesn't matter much.

            That could work, yes. But I was hoping for a V-Ray solution as it'd be so much easier to update.

            Now I need to select and correct the background in PhotoShop before using the mask. πŸ˜•

            Thomas Thomassen β€” SketchUp Monkey & Coding addict
            List of my plugins and link to the CookieWare fund

            1 Reply Last reply Reply Quote 0
            • andybotA Offline
              andybot
              last edited by

              That's really odd. Do you want to share the SU file with the models stripped out and just some placeholders for where you are supposed to be getting z-depth. My guess is that somehow your z depth values are off slightly and so the foreground and background are getting clamped out in the zdepth channel.

              http://charlottesvillearchitecturalrendering.com/

              1 Reply Last reply Reply Quote 0
              • R Offline
                rspierenburg
                last edited by

                Well from what I figure you have set. Anything in front of 4000" will not be black and anything past 18000" will be white. So what I'm seeing is typically what depth of field would show, because anything in front of 4000" would be blurry, things AT 4000" would be in focus and then focus would be reduced until you hit 18000". So I would just adjust your values to be more exaggerated say 3000" and 25000" and see what happens.

                1 Reply Last reply Reply Quote 0
                • thomthomT Offline
                  thomthom
                  last edited by

                  But - then I'd expect the fore ground blur to fade towards 4000. It just abruptly jumps.

                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                  List of my plugins and link to the CookieWare fund

                  1 Reply Last reply Reply Quote 0
                  • thomthomT Offline
                    thomthom
                    last edited by

                    Just to try what you suggested. It just looks clipped:

                    Render18.ZDepth.png

                    It's looking more like a bug - there the out of range values are filled with the wrong colours. It appear to fill the z depth closer than with the Max colour, and the z depth further away than Maxmium with the Minimum colour...

                    Thomas Thomassen β€” SketchUp Monkey & Coding addict
                    List of my plugins and link to the CookieWare fund

                    1 Reply Last reply Reply Quote 0
                    • andybotA Offline
                      andybot
                      last edited by

                      AFAIK - clipped areas will show as white in the zdepth channel, not black. - both front and back clipped areas.

                      http://charlottesvillearchitecturalrendering.com/

                      1 Reply Last reply Reply Quote 0
                      • thomthomT Offline
                        thomthom
                        last edited by

                        @andybot said:

                        AFAIK - clipped areas will show as white in the zdepth channel, not black. - both front and back clipped areas.

                        See this example from V-Ray fro Max. The render diaply the V-Ray environment in the backgroud - similar to my scene, but the Z depth is black for the background. It fades from white to black.

                        I'd set up mine to be black is nearest, while white was furthest away.
                        Render22.ZDepth.png
                        Here foreground and background is white.

                        I then flip it around, white is closest and black is furthest away:
                        Render23.ZDepth.png
                        Here the foreground and background is white. But this deviates from what you see in the V-Ray from Max example linked at the top.

                        Searching other V-Ray for Max examples never show the same behaviour I see in VfSU. It looks like a bug in VfSU. (Wish I has VfMax now...)

                        Thomas Thomassen β€” SketchUp Monkey & Coding addict
                        List of my plugins and link to the CookieWare fund

                        1 Reply Last reply Reply Quote 0
                        • thomthomT Offline
                          thomthom
                          last edited by

                          http://www.workshop.mintviz.com/tutorials/depth-of-field-using-vray-zdepth/

                          Thomas Thomassen β€” SketchUp Monkey & Coding addict
                          List of my plugins and link to the CookieWare fund

                          1 Reply Last reply Reply Quote 0
                          • V Offline
                            valerostudio
                            last edited by

                            Where in VRay Toys is this measure tool?

                            1 Reply Last reply Reply Quote 0
                            • V Offline
                              valerostudio
                              last edited by

                              Isn't there a trick to make a Z-Depth channel using Styles in SU?

                              1 Reply Last reply Reply Quote 0
                              • thomthomT Offline
                                thomthom
                                last edited by

                                @valerostudio said:

                                Where in VRay Toys is this measure tool?

                                In the menus. But it might be introduced in version 2.0 - which is unreleased. Need to fix some OSX issues.

                                Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                List of my plugins and link to the CookieWare fund

                                1 Reply Last reply Reply Quote 0
                                • thomthomT Offline
                                  thomthom
                                  last edited by

                                  @valerostudio said:

                                  Isn't there a trick to make a Z-Depth channel using Styles in SU?

                                  Yea, using fog. But then you need to export up an image much larger than the V-Ray image - and sample it down to get a nice anti-aliasing.

                                  Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                  List of my plugins and link to the CookieWare fund

                                  1 Reply Last reply Reply Quote 0
                                  • andybotA Offline
                                    andybot
                                    last edited by

                                    When you have the alpha channel selected, the background will be drawn as black in the zdepth channel. Try rendering without the alpha channel. The thing you can do to avoid the clipping is to set your zdepth distances to include all of your model, and then in photoshop, you can adjust the levels so all of your foreground is black.

                                    Andy

                                    http://charlottesvillearchitecturalrendering.com/

                                    1 Reply Last reply Reply Quote 0
                                    • thomthomT Offline
                                      thomthom
                                      last edited by

                                      But I haven't been rendering with Alpha. It's been all without.

                                      Thomas Thomassen β€” SketchUp Monkey & Coding addict
                                      List of my plugins and link to the CookieWare fund

                                      1 Reply Last reply Reply Quote 0
                                      • andybotA Offline
                                        andybot
                                        last edited by

                                        @thomthom said:

                                        But I haven't been rendering with Alpha. It's been all without.

                                        I had a chance to look at it some more. You're right, alpha was not on - but it still rendered areas without geometry as black. I tried the "z-depth catcher" plane - and it does work in making the background white. I did a quick check- and if the plane is beyond the rear clipping distance, it still shows up as white, so I assume that anything that's clipped by vray is drawn as white, but anything transparent is shown as black.

                                        I agree that it's really not an optimal situation. It should clip the foreground to black, the background to white, and draw transparency as white (to assume that you are looking at the back distance...)

                                        http://charlottesvillearchitecturalrendering.com/

                                        1 Reply Last reply Reply Quote 0
                                        • 1 / 1
                                        • First post
                                          Last post
                                        Buy SketchPlus
                                        Buy SUbD
                                        Buy WrapR
                                        Buy eBook
                                        Buy Modelur
                                        Buy Vertex Tools
                                        Buy SketchCuisine
                                        Buy FormFonts

                                        Advertisement