Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice
  3. Join us on November 16th, 2023, between 1 pm and 9 pm CET for Ask the Experts Online on Discord and on Unity Discussions.
    Dismiss Notice

DrawProcedural / CommandBuffers

Discussion in 'Shaders' started by Plutoman, Jun 16, 2015.

  1. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    I'm working with the new feature from Unity 5.1, Command Buffers & Draw Procedural. The latter command called by the Graphics library does not allow integration with the deferred lighting pipeline. So I wanted to set up a command buffer that put the mesh into the middle of the rendering process, and thus let it still react to lighting.

    However, it doesn't work - I'm getting some odd bugs. If I set the camera event to before lighting, the color of the object gets reset (when I had ambient intensity to max, it was set to the skybox color.. when I turned it to 0, it reset to just white), ignoring the texture calls. However, the alpha test clipping still occurs, just the returned color value is incorrect.

    If I set it to other points in the rendering process, the lighting doesn't happen at all, I can't get shadows to hit the geometry, nor can I get the geometry to actually be lit.

    Here's a test project for this..
    https://www.dropbox.com/s/7r56c8odwetz5yk/CmdBufferDrawProcedural.zip?dl=0
    (mirrored on dropbox as it didn't seem to be uploading.. guess it did though!)

    Wanted to first check to make sure I wasn't missing any intended functionality before reporting it as a bug!
     

    Attached Files:

  2. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    Bumping this?
     
  3. Plutoman

    Plutoman

    Joined:
    May 24, 2013
    Posts:
    257
    As I bump this, I've figured out the issue, essentially.

    One, shadows are rendered from a camera. That means, draw procedural, attached to a command buffer, actually can't see those objects. Makes sense there. Two, emission values of 1 or higher (I had it set to 1) cause the object to take on the pure background ambient color. Not entirely sure why on that one, but it works now.. I have an object that actually takes on lighting from the scene.

    https://www.dropbox.com/s/f812l52tdub7liz/Screenshot 2015-06-24 14.10.17.png?dl=0
     
  4. trek7

    trek7

    Joined:
    Feb 8, 2015
    Posts:
    4
    can you explain how you figured it out and/or show some code? that would be nice! right now i have a lot of particles, drawn with drawProcedural (or commandBuffer.drawProcedural), but I am still not able to get any informations into my depthbuffer.