|
View:
New views
4 Messages
—
Rating Filter:
Alert me
|
|
|
Shading optimization for RiCurvesHi Trevor,
I'm taking this discussion on-list again as it's moving on to discussing the design. On Fri, Aug 28, 2009 at 6:46 PM, Trevor Lovett<trevlovett@...> wrote: >> The shading load will still be about the same at this stage won't it? I >> take it that you haven't actually touched the shading yet? (I will get >> around to reading the code soon). > > Haven't looked into the actual shading yet--what do I need to override to do > hair-specific shading? And as far as what optimizations to put in > place--currently we store two identical normals for every micropoly-segment > along the backbone. So, after lighting calculations or anything else > normal-dependent, the shader vm must be interpolating between two identical > values. Actually, the shaderVM does no interpolation at all. As I understand it, shading in realtime graphics is quite different from shading in reyes: - In realtime graphics shaders run on fragments in screen space, *after* sampling the geometry. - In reyes shading is done on the *vertices* of the grids in camera space, *before* sampling. The advantages are that the shading is decoupled from the sampling, you can define derivatives on the grids, etc. For normal 2D geometry, we have a 2D grid: +---+---+---+ | | | | +---+---+---+ | | | | +---+---+---+ | | | | +---+---+---+ and the points at which the shader runs are the vertices (the plusses in the diagram). For curves what we want to do is shade only the 1D backbone of the grid. That is, if we have the grid +---+---+---+---+---+---+ | | | | | | | +---+---+---+---+---+---+ from the point of view of the shaderVM, we want this to be just the top edge +---+---+---+---+---+---+ After shading, we should copy the results of shading across the width of the curve so that when the time comes to sample the sampling code has all the necessary data. > Without knowing how we do shading, that seems like something we > could fix. There's a bit of code to go through in the shading department so > if you know of another primitive that uses a custom shading method that > would help get things started. Currently there are two types of grids: point grids and regular micropolygon grids; - The point "grids" represent a set of independent zero-dimensional points - The regular grids are for 2D surfaces. To make shading efficient for curves, we're going to need to define a new type of grid; a 1D grid especially for hair-like 1D geometry. The main difference between the types of grid from the point of view of the shaderVM is that derivatives are defined differently. In particular, all types of derivatives for 0D grids are always zero. 2D grids have derivatives in both directions, while 1D grids should have derivatives only in one direction (IIRC, the v-direction by default). ~Chris ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Aqsis-development mailing list Aqsis-development@... https://lists.sourceforge.net/lists/listinfo/aqsis-development |
|
|
Re: Shading optimization for RiCurvesOn Sun, Aug 30, 2009 at 8:30 AM, Chris Foster <chris42f@...> wrote: Hi Trevor, Thanks for that--it's clear now. I realized going through the email history that you outlined this before when we were first discussing the curves work.
Looks like the next step should be to subclass CqMicroPolyGrid and override Shade(). Perhaps we can discuss this near the end of the dev meeting?
------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Aqsis-development mailing list Aqsis-development@... https://lists.sourceforge.net/lists/listinfo/aqsis-development |
|
|
Re: Shading optimization for RiCurvesfwiw... the problem sounds analogous to rough rasterization of small
vector typefaces in PostScript/TrueType. They solved that by adding hinting while preserving the standard glyph definition interface. In Aqsis' case, the hair prim would have a LOD system generate (at high LOD) bent cylinders with normal shader calls, and low LOD would use hints to fine-tune the shader calls, shader results, fragment rasterization, etc. Ray Trevor Lovett wrote: > > > On Sun, Aug 30, 2009 at 8:30 AM, Chris Foster <chris42f@... > <mailto:chris42f@...>> wrote: > > Hi Trevor, > > I'm taking this discussion on-list again as it's moving on to > discussing the design. > > On Fri, Aug 28, 2009 at 6:46 PM, Trevor Lovett<trevlovett@... > <mailto:trevlovett@...>> wrote: > >> The shading load will still be about the same at this stage > won't it? I > >> take it that you haven't actually touched the shading yet? (I > will get > >> around to reading the code soon). > > > > Haven't looked into the actual shading yet--what do I need to > override to do > > hair-specific shading? And as far as what optimizations to put in > > place--currently we store two identical normals for every > micropoly-segment > > along the backbone. So, after lighting calculations or anything else > > normal-dependent, the shader vm must be interpolating between two > identical > > values. > > Actually, the shaderVM does no interpolation at all. As I > understand it, > shading in realtime graphics is quite different from shading in reyes: > - In realtime graphics shaders run on fragments in screen space, *after* > sampling the geometry. > - In reyes shading is done on the *vertices* of the grids in camera > space, > *before* sampling. > > The advantages are that the shading is decoupled from the sampling, > you can > define derivatives on the grids, etc. > > For normal 2D geometry, we have a 2D grid: > > +---+---+---+ > | | | | > +---+---+---+ > | | | | > +---+---+---+ > | | | | > +---+---+---+ > > and the points at which the shader runs are the vertices (the > plusses in the > diagram). > > For curves what we want to do is shade only the 1D backbone of the > grid. That > is, if we have the grid > > +---+---+---+---+---+---+ > | | | | | | | > +---+---+---+---+---+---+ > > from the point of view of the shaderVM, we want this to be just the > top edge > > +---+---+---+---+---+---+ > > After shading, we should copy the results of shading across the > width of the > curve so that when the time comes to sample the sampling code has > all the > necessary data. > > > Thanks for that--it's clear now. I realized going through the email > history that you outlined this before when we were first discussing the > curves work. > > > > > > Without knowing how we do shading, that seems like something we > > could fix. There's a bit of code to go through in the shading > department so > > if you know of another primitive that uses a custom shading > method that > > would help get things started. > > Currently there are two types of grids: point grids and regular > micropolygon > grids; > - The point "grids" represent a set of independent zero-dimensional > points > - The regular grids are for 2D surfaces. > > To make shading efficient for curves, we're going to need to define > a new type > of grid; a 1D grid especially for hair-like 1D geometry. > > The main difference between the types of grid from the point of view > of the > shaderVM is that derivatives are defined differently. In particular, > all types of derivatives for 0D grids are always zero. 2D grids have > derivatives in both directions, while 1D grids should have > derivatives only in > one direction (IIRC, the v-direction by default). > > > Looks like the next step should be to subclass CqMicroPolyGrid and > override Shade(). Perhaps we can discuss this near the end of the dev > meeting? > > > > ~Chris > > > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day > trial. Simplify your report design, integration and deployment - and focus on > what you do best, core application coding. Discover what's new with > Crystal Reports now. http://p.sf.net/sfu/bobj-july > > > ------------------------------------------------------------------------ > > _______________________________________________ > Aqsis-development mailing list > Aqsis-development@... > https://lists.sourceforge.net/lists/listinfo/aqsis-development ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Aqsis-development mailing list Aqsis-development@... https://lists.sourceforge.net/lists/listinfo/aqsis-development |
|
|
Re: Shading optimization for RiCurvesOn Mon, Aug 31, 2009 at 7:25 AM, Ray Gardener<rayg@...> wrote:
> fwiw... the problem sounds analogous to rough rasterization of small > vector typefaces in PostScript/TrueType. > > They solved that by adding hinting while preserving the standard glyph > definition interface. In Aqsis' case, the hair prim would have a LOD > system generate (at high LOD) bent cylinders with normal shader calls, > and low LOD would use hints to fine-tune the shader calls, shader > results, fragment rasterization, etc. Currently we have an attribute Attribute "dice" "hair" 1 which enables dicing curves as 1D geometry, which I think will be sufficient. (This is the same as what PRMan does, btw). One problem with automatic LOD for curves is that shaders need to be written in a different way depending on whether they shade a primitive which is 1D (hair-like curves) or 2D (wide curves). The subject of LOD for curves is a tricky one in general I think. One of the best methods is probably stochastic simplification where some curves are removed and others are widened, but I'm not sure this could be easily and efficiently implemented in the renderer itself (at the least, consistency of the simplification between frames would likely be a thorny issue). It can certainly be implemented during the content generation stage inside a procedural - IIRC this is Pixar did for the film Ratatouille. ~Chris. ------------------------------------------------------------------------------ Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day trial. Simplify your report design, integration and deployment - and focus on what you do best, core application coding. Discover what's new with Crystal Reports now. http://p.sf.net/sfu/bobj-july _______________________________________________ Aqsis-development mailing list Aqsis-development@... https://lists.sourceforge.net/lists/listinfo/aqsis-development |
| Free embeddable forum powered by Nabble | Forum Help |