Separating actors for different render passes

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Separating actors for different render passes

Milef, Nicholas Boris
Is there currently a way to separate actors into custom render passes? If I'm not mistaken, opaque objects currently get rendered before translucent objects, but is there a way to add additional geometry passes (or before opaque geometry, or between translucent and opaque geometry, etc.)?

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Separating actors for different render passes

Ken Martin
With the render passes you can setup as many passes as you want in whatever order you want. This shows an example where the render process is all driven by passes.


As an example for shadow maps when needed we use nested opaque passes to render the scene from the view of the light sources which we then use in another opaque pass to compute lighting from the view of the camera.

Render passes also have hooks that mappers call so that passes can modify the mapper shader code etc while executing.

Passes can also use information properties on actors to filter them in other passes.  For example an outer render pass can add information on actors that causes some of them to not be rendered (or to be rendered differently) by other passes ala

// ----------------------------------------------------------------------------
// Description:
// Opaque pass with key checking.
// \pre s_exists: s!=0
void vtkDefaultPass::RenderFilteredOpaqueGeometry(const vtkRenderState *s)
{
  assert("pre: s_exists" && s!=0);

  int c=s->GetPropArrayCount();
  int i=0;
  while(i<c)
  {
    vtkProp *p=s->GetPropArray()[i];
    if(p->HasKeys(s->GetRequiredKeys()))
    {
      int rendered=
        p->RenderFilteredOpaqueGeometry(s->GetRenderer(),s->GetRequiredKeys());
      this->NumberOfRenderedProps+=rendered;
    }
    ++i;
  }
}




On Thu, Jul 6, 2017 at 3:30 PM, Milef, Nicholas Boris <[hidden email]> wrote:
Is there currently a way to separate actors into custom render passes? If I'm not mistaken, opaque objects currently get rendered before translucent objects, but is there a way to add additional geometry passes (or before opaque geometry, or between translucent and opaque geometry, etc.)?

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Separating actors for different render passes

Milef, Nicholas Boris
Thanks Ken! This is just what I was looking for. A couple of followup questions:

1. Is it possible to have an actor with different shaders for different passes? Or would we need to use separate actors/mappers since each mapper only has one shader? Recompiling shaders on the fly isn't an option for us.
2. Is it possible to replace the default vtkDefaultPass for the vtkRenderer with a different subclass of vtkDefaultPass or at least disable the default vtkDefaultPass? I couldn't find any API commands that would allow me to do this without subclassing the vtkRenderer, but I could've missed something.

From: Ken Martin [[hidden email]]
Sent: Thursday, July 06, 2017 4:18 PM
To: Milef, Nicholas Boris
Cc: [hidden email]
Subject: Re: [vtkusers] Separating actors for different render passes

With the render passes you can setup as many passes as you want in whatever order you want. This shows an example where the render process is all driven by passes.


As an example for shadow maps when needed we use nested opaque passes to render the scene from the view of the light sources which we then use in another opaque pass to compute lighting from the view of the camera.

Render passes also have hooks that mappers call so that passes can modify the mapper shader code etc while executing.

Passes can also use information properties on actors to filter them in other passes.  For example an outer render pass can add information on actors that causes some of them to not be rendered (or to be rendered differently) by other passes ala

// ----------------------------------------------------------------------------
// Description:
// Opaque pass with key checking.
// \pre s_exists: s!=0
void vtkDefaultPass::RenderFilteredOpaqueGeometry(const vtkRenderState *s)
{
  assert("pre: s_exists" && s!=0);

  int c=s->GetPropArrayCount();
  int i=0;
  while(i<c)
  {
    vtkProp *p=s->GetPropArray()[i];
    if(p->HasKeys(s->GetRequiredKeys()))
    {
      int rendered=
        p->RenderFilteredOpaqueGeometry(s->GetRenderer(),s->GetRequiredKeys());
      this->NumberOfRenderedProps+=rendered;
    }
    ++i;
  }
}




On Thu, Jul 6, 2017 at 3:30 PM, Milef, Nicholas Boris <[hidden email]> wrote:
Is there currently a way to separate actors into custom render passes? If I'm not mistaken, opaque objects currently get rendered before translucent objects, but is there a way to add additional geometry passes (or before opaque geometry, or between translucent and opaque geometry, etc.)?

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate

Re: Separating actors for different render passes

Ken Martin
On Sun, Jul 9, 2017 at 4:33 PM, Milef, Nicholas Boris <[hidden email]> wrote:
Thanks Ken! This is just what I was looking for. A couple of followup questions:

1. Is it possible to have an actor with different shaders for different passes?

The passes can modify a mapper's shader but a mapper does not store shaders per pass.
 
Or would we need to use separate actors/mappers since each mapper only has one shader? Recompiling shaders on the fly isn't an option for us.

VTK caches and shares shaders between mappers so once a given shader program has been used once it will be not recompiled for the duration of the run. 
 
2. Is it possible to replace the default vtkDefaultPass for the vtkRenderer with a different subclass of vtkDefaultPass or at least disable the default vtkDefaultPass? I couldn't find any API commands that would allow me to do this without subclassing the vtkRenderer, but I could've missed something.

When you specify a render pass on the renderer, whatever render pass you specify takes full control of the render process and the default process is skipped. 

Thanks
Ken

 

From: Ken Martin [[hidden email]]
Sent: Thursday, July 06, 2017 4:18 PM
To: Milef, Nicholas Boris
Cc: [hidden email]
Subject: Re: [vtkusers] Separating actors for different render passes

With the render passes you can setup as many passes as you want in whatever order you want. This shows an example where the render process is all driven by passes.


As an example for shadow maps when needed we use nested opaque passes to render the scene from the view of the light sources which we then use in another opaque pass to compute lighting from the view of the camera.

Render passes also have hooks that mappers call so that passes can modify the mapper shader code etc while executing.

Passes can also use information properties on actors to filter them in other passes.  For example an outer render pass can add information on actors that causes some of them to not be rendered (or to be rendered differently) by other passes ala

// ----------------------------------------------------------------------------
// Description:
// Opaque pass with key checking.
// \pre s_exists: s!=0
void vtkDefaultPass::RenderFilteredOpaqueGeometry(const vtkRenderState *s)
{
  assert("pre: s_exists" && s!=0);

  int c=s->GetPropArrayCount();
  int i=0;
  while(i<c)
  {
    vtkProp *p=s->GetPropArray()[i];
    if(p->HasKeys(s->GetRequiredKeys()))
    {
      int rendered=
        p->RenderFilteredOpaqueGeometry(s->GetRenderer(),s->GetRequiredKeys());
      this->NumberOfRenderedProps+=rendered;
    }
    ++i;
  }
}




On Thu, Jul 6, 2017 at 3:30 PM, Milef, Nicholas Boris <[hidden email]> wrote:
Is there currently a way to separate actors into custom render passes? If I'm not mistaken, opaque objects currently get rendered before translucent objects, but is there a way to add additional geometry passes (or before opaque geometry, or between translucent and opaque geometry, etc.)?

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers




--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.



--
Ken Martin PhD
Distinguished Engineer
Kitware Inc.
28 Corporate Drive
Clifton Park NY 12065

This communication, including all attachments, contains confidential and legally privileged information, and it is intended only for the use of the addressee.  Access to this email by anyone else is unauthorized. If you are not the intended recipient, any disclosure, copying, distribution or any action taken in reliance on it is prohibited and may be unlawful. If you received this communication in error please notify us immediately and destroy the original message.  Thank you.

_______________________________________________
Powered by www.kitware.com

Visit other Kitware open-source projects at http://www.kitware.com/opensource/opensource.html

Please keep messages on-topic and check the VTK FAQ at: http://www.vtk.org/Wiki/VTK_FAQ

Search the list archives at: http://markmail.org/search/?q=vtkusers

Follow this link to subscribe/unsubscribe:
http://public.kitware.com/mailman/listinfo/vtkusers
Loading...