Hi,<div><div><br></div><div>Okay, so think about a single ray.</div><div><br></div><div>Now assume your simulation is just the root grid, and it has a density of 1, with 10 cells and a box length of 1.</div><div>Now let your transfer function be such that the rgb emission at density of 1 is (0.1,0.2,0.3)</div>

<div><br></div><div>Your ds = 0.1</div><div><br></div><div>Result = 10 (total steps to traverse the volume) * (0.1, 0.2, 0.3) * 0.1 (your ds)  = (0.1, 0.2 ,0.3)</div><div><br></div><div>Now say your volume is refined by 10 levels, so you have a total of 1024 cells.  </div>

<div>Your ds is now 1./1024</div><div><br></div><div>Result = 1024 (total steps to traverse the volume) * (0.1, 0.2, 0.3) * 1./1024 (your ds)  = (0.1, 0.2 ,0.3)</div><div><br></div><div>Now just imagine you do the same process for every pixel, since every pixel is a ray.</div>

<div><br></div><div>I see britton just responded with a similar reasoning.  Hope this helps.</div><div><br></div><div>Sam</div><div><br></div><div><br><div class="gmail_quote">On Tue, Apr 12, 2011 at 11:51 AM, Maike Schmidt <span dir="ltr"><<a href="mailto:maikeschmidt2@gmx.de">maikeschmidt2@gmx.de</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">Hi Britton,<br>
<br>
sure, but with 10 refinement levels, the smallest cells are a factor<br>
of 10^3 smaller than the largest ones. So 10 times a factor of 10^3<br>
smaller compared to 10 times 1 is still a factor of 10^3 smaller...<br>
<br>
Maike<br>
<br>
<br>
-------- Original-Nachricht --------<br>
> Datum: Tue, 12 Apr 2011 11:43:45 -0400<br>
> Von: Britton Smith <<a href="mailto:brittonsmith@gmail.com">brittonsmith@gmail.com</a>><br>
<div><div></div><div class="h5">> An: Discussion of the yt analysis package <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
> Betreff: Re: [yt-users] volume rendering<br>
<br>
> Hi Maike,<br>
><br>
> The area of the grid cell in the image plane does not really matter.  It<br>
> is<br>
> only the width of the grid cell in the line of sight that factors in.<br>
> Therefore, if you have 10 cells replacing a single cell in the line of<br>
> sight, each of them will contribute 1/10 of the emission.  The<br>
> contribution<br>
> of each cell does not go as dx^3, just dx.<br>
><br>
> Britton<br>
><br>
> On Tue, Apr 12, 2011 at 11:34 AM, Maike Schmidt<br>
> <<a href="mailto:maikeschmidt2@gmx.de">maikeschmidt2@gmx.de</a>>wrote:<br>
><br>
> > Hi Sam,<br>
> ><br>
> > I still don't understand this. The small ds's will only yield the<br>
> > same integration as the large ds's if the physical width of the<br>
> > isosurface is the same on all refinement levels. If the width is,<br>
> > say, 10 cells on each refinement level, then the smallest ds's<br>
> > will only emit 1/1000 of the contribution of the largest ds's.<br>
> > In fact, if the emission is directly proportional to the RGB value,<br>
> > then even a factor of 100 will make the color so dark that the<br>
> > contribution to the final image is invisible. In this case you<br>
> > would see the isosurface only on the largest scales.<br>
> ><br>
> > Is this what would happen?<br>
> ><br>
> > Cheers,<br>
> > Maike<br>
> ><br>
> ><br>
> ><br>
> > > Hi Maike,<br>
> > ><br>
> > > I think there is some confusion here about how our transfer function<br>
> > > works.<br>
> > >  For the ColorTransferFunction, we are really specifying r,g,b<br>
> > >  emissivities.  For example, let's say that we have chosen to specify<br>
> > that<br>
> > > a<br>
> > > density value of 5 corresponds to rgb = [0.5,0.5,0.5], whatever that<br>
> > color<br>
> > > may be.  Now, that does not mean that when the rays pass through an<br>
> area<br>
> > > with a density of 5 that the rgb images will be equal to 0.5,0.5,0.5.<br>
> > >  Rather, we will add j*ds to the image plane.  If the entire domain<br>
> had a<br>
> > > density of 5, then the resulting image would be (some<br>
> > > factor)*[0.5,0.5,0.5]<br>
> > > where the factor has to do with the integration length.  If instead<br>
> the<br>
> > > density=5 region was just in part of the volume, then it would add up<br>
> the<br>
> > > contribution to the final image, and it would  be blended along the<br>
> line<br>
> > > of<br>
> > > sight with any other emission from the rest of the volume.<br>
> > ><br>
> > > If you take your example of an AMR sim with 10 levels, then using the<br>
> > > implementation we have written, while the high levels have much<br>
> smaller<br>
> > > ds's, there are many more of them, which will yield roughly the same<br>
> > > integration as had it been down only using the lower resolution data.<br>
> It<br>
> > > is<br>
> > > a lot like an adaptive integration scheme in that sense.<br>
> > ><br>
> > > Does this help?  Please let us know.<br>
> > ><br>
> > > Best,<br>
> > > Sam<br>
> > ><br>
> > > On Wed, Apr 6, 2011 at 4:27 AM, Maike Schmidt <<a href="mailto:maikeschmidt2@gmx.de">maikeschmidt2@gmx.de</a>><br>
> > > wrote:<br>
> > ><br>
> > > > Hi Matt,<br>
> > > ><br>
> > > > many thanks for this really nice explanation! But I still<br>
> > > > don't understand how the color transfer function works.<br>
> > > > I thought that, if you add a Gaussian with peak (r,g,b),<br>
> > > > then the intensity that arrives at the camera from cells<br>
> > > > that contain the center of the Gaussian has exactly intensity<br>
> > > > (r,g,b), when I am neglecting absorption. Otherwise I don't<br>
> > > > understand how one can relate the color of the Gaussian<br>
> > > > to the color at the camera.<br>
> > > ><br>
> > > > Now, say I want to visualize an isosurface of density<br>
> > > > on an AMR grid with 10 refinement levels, then the actual<br>
> > > > intensity contribution j * delta s will differ by 3 orders<br>
> > > > of magnitude for cells with the same density but different<br>
> > > > cell size. How do you make all these cells emit the same color?<br>
> > > > This is what I don't understand.<br>
> > > ><br>
> > > > I guess it boils down to the question of how exactly you<br>
> > > > calculate your j in the radiative transfer equation when<br>
> > > > you have a color transfer function, say a single Gaussian<br>
> > > > with peak (r,g,b).<br>
> > > ><br>
> > > > Many thanks,<br>
> > > > Maike<br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > ><br>
> > > > -------- Original-Nachricht --------<br>
> > > > > Datum: Tue, 5 Apr 2011 16:29:02 -0400<br>
> > > > > Von: Matthew Turk <<a href="mailto:matthewturk@gmail.com">matthewturk@gmail.com</a>><br>
> > > > > An: Discussion of the yt analysis package<br>
> > > <<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a>><br>
> > > > > Betreff: Re: [yt-users] volume rendering<br>
> > > ><br>
> > > > > Hi Maike,<br>
> > > > ><br>
> > > > > (I think this is your first post -- welcome to yt-users!)<br>
> > > > ><br>
> > > > > On Tue, Apr 5, 2011 at 11:34 AM, Maike Schmidt<br>
> <<a href="mailto:maikeschmidt2@gmx.de">maikeschmidt2@gmx.de</a><br>
> > ><br>
> > > > > wrote:<br>
> > > > > > Hi together,<br>
> > > > > ><br>
> > > > > > I would like to better understand how the volume rendering<br>
> works.<br>
> > > > > > It is explained here<br>
> > > > > ><br>
> > > > > > <a href="http://yt.spacepope.org/doc/visualizing/volume_rendering.html" target="_blank">http://yt.spacepope.org/doc/visualizing/volume_rendering.html</a><br>
> > > > > ><br>
> > > > > > that the user defines transfer functions in terms of RGB values.<br>
> > > > > > From the description of the add_gaussian function, I understand<br>
> > > > > > that these RGB values describe the color value in the interval<br>
> > > > > > [0,1]. Now, in the radiative transfer equation on the above<br>
> > > > > > website, the emissivity gets multiplied by the path length<br>
> > > > > > delta s. I am now wondering how this works: Depending on how<br>
> > > > > > big the step size is, one could get extremely large or extremely<br>
> > > > > > small intensities that are essentially unrelated to the RGB<br>
> > > > > > values that were previously specified. How is it possible that,<br>
> > > > > > for example, the color of a density isosurface depends on the<br>
> > > > > > density only and not on the cell size? I guess I am missing<br>
> > > > > > something.<br>
> > > > > ><br>
> > > > > > Cheers,<br>
> > > > > > Maike<br>
> > > > > ><br>
> > > > ><br>
> > > > > The short answer, I think, is that you are right, you can get very<br>
> > > > > large intensities in large cells that are unrelated to what came<br>
> > > > > before.  But, for the most part, this is not an issue because of<br>
> how<br>
> > > > > the weighting and color assignments are typically done.<br>
> > > > ><br>
> > > > > [begin long, rambly answer]<br>
> > > > ><br>
> > > > > There are a couple things in what you ask -- the first is that<br>
> there<br>
> > > > > are two primary methods for volume rendering.  The first is to<br>
> tell a<br>
> > > > > story using somewhat abstract visuals; this is typically what<br>
> people<br>
> > > > > think of when they think of volume rendering, and it is supported<br>
> by<br>
> > > > > (and possibly the primary application of) yt.  This would be<br>
> what's<br>
> > > > > used when the ColorTransferFunction is used.  The other is<br>
> designed<br>
> > to<br>
> > > > > perform a meaningful line integral through the calculation; this<br>
> is<br>
> > > > > what's done with the ProjectionTransferFunction and the<br>
> > > > > PlanckTransferFunction.  In all cases, the RT equation *is*<br>
> > > > > integrated, but what varies between the two mechanisms is where<br>
> the<br>
> > > > > emission and absorption values come from.<br>
> > > > ><br>
> > > > > In all cases, while the code may call things RGB, they need not be<br>
> > RGB<br>
> > > > > explicitly.  In fact, for the ProjectionTransferFunction, they are<br>
> > > > > not.  For the ProjectionTransferFunction, the code simply<br>
> integrates<br>
> > > > > with the emission value being set to the fluid value in a cell and<br>
> > the<br>
> > > > > absorption value set to exactly zero.  This results in the<br>
> > > > > integration:<br>
> > > > ><br>
> > > > > dI/ds = v_local<br>
> > > > ><br>
> > > > > Where v_local is the (interpolated) fluid value at every point the<br>
> > > > > integration samples, which defaults to 5 subsamples within a given<br>
> > > > > cell.  So the final intensity is equal to the sum of all<br>
> > > > > (interpolated) values along a ray times the (local-to-a-cell) path<br>
> > > > > length between samples.  For the PlanckTransferFunction, the local<br>
> > > > > emission is set to some approximation of a black-body, weighted<br>
> with<br>
> > > > > Density for emission, and the absorption is set to an<br>
> approximation<br>
> > of<br>
> > > > > scattering, which we then assign to RGB.  The PTF also utilizes a<br>
> > > > > 'weighting' field inside the volume renderer, which I discuss<br>
> briefly<br>
> > > > > below, to allow it to utilize multiple variables at a given<br>
> location<br>
> > > > > to calculate the emission and absorption.  (i.e., Temperature<br>
> governs<br>
> > > > > the color, density governs the strength of the emission -- sliding<br>
> > > > > along x and scaling along y, in the plot of the transfer<br>
> function.)<br>
> > > > ><br>
> > > > > When integrating a ColorTransferFunction, the situation is<br>
> somewhat<br>
> > > > > different.  I've spent a bit of time reviewing the code, and I<br>
> think<br>
> > I<br>
> > > > > can provide a definite answer to your question.  For reference,<br>
> the<br>
> > > > > code that this calls upon is defined in two source files:<br>
> > > > ><br>
> > > > > yt/visualization/volume_rendering/transfer_functions.py<br>
> > > > > yt/utilities/_amr_utils/VolumeIntegrator.pyx<br>
> > > > ><br>
> > > > > Specifically, in the class ColorTransferFunction and in the<br>
> > > > > FIT_get_value and TransferFunctionProxy.eval_transfer functions.<br>
> > > > ><br>
> > > > > The ColorTransferFunction, which is designed for visualizing<br>
> abstract<br>
> > > > > isocontours, rather than computing an actual line integral that is<br>
> > > > > then examined or modified, sets a weighting *table*.  (For the<br>
> > > > > PlanckTransferFunction, a weight_field_id is set; this means to<br>
> > > > > multiply the value from a table against a value obtained from<br>
> another<br>
> > > > > field.  This is how density-weighted emission is done.)  The<br>
> > > > > weight_table_id for CTF is set to the table for the alpha<br>
> emission.<br>
> > > > > Functionally, this means that we accentuate the peaks and spikes<br>
> in<br>
> > > > > the color transfer function, because alpha is typically set quite<br>
> > high<br>
> > > > > at the gaussians included.<br>
> > > > ><br>
> > > > > So in essence, with a color transfer function we accentuate only<br>
> the<br>
> > > > > regions where we have isocontours.  I think it's easiest to speak<br>
> > > > > about this in terms of a visualization of Density isocontours.  If<br>
> > you<br>
> > > > > place contours in the outer regions, if your emission value is too<br>
> > > > > high, it will indeed obscure completely the inner regions.  I have<br>
> > > > > experimented with this and have found that it is extremely easy to<br>
> > > > > create a completely visually confusing image that contains only<br>
> the<br>
> > > > > outer contours and wispy hints of the inner contours.<br>
> > > > ><br>
> > > > > However, even if you do have outer isocontours, if you set the<br>
> > > > > emission and color values lower, you can indeed provide glimpses<br>
> into<br>
> > > > > the inner regions.  The inner regions are likely generating<br>
> *higher*<br>
> > > > > emission values (this is certainly how it is done in yt, with the<br>
> > > > > add_layers method on ColorTransferFunction.)<br>
> > > > ><br>
> > > > > Anyway, I hope that helps clear things up a little bit -- but<br>
> please<br>
> > > > > feel free to write back with any further questions about this or<br>
> > > > > anything else.<br>
> > > > ><br>
> > > > > Best,<br>
> > > > ><br>
> > > > > Matt<br>
> > > > ><br>
> > > > > ><br>
> > > > > > --<br>
> > > > > > GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit<br>
> > > > > > gratis Handy-Flat! <a href="http://portal.gmx.net/de/go/dsl" target="_blank">http://portal.gmx.net/de/go/dsl</a><br>
> > > > > > _______________________________________________<br>
> > > > > > yt-users mailing list<br>
> > > > > > <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> > > > > > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
> > > > > ><br>
> > > > > _______________________________________________<br>
> > > > > yt-users mailing list<br>
> > > > > <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> > > > > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
> > > ><br>
> > > > --<br>
> > > > NEU: FreePhone - kostenlos mobil telefonieren und surfen!<br>
> > > > Jetzt informieren: <a href="http://www.gmx.net/de/go/freephone" target="_blank">http://www.gmx.net/de/go/freephone</a><br>
> > > > _______________________________________________<br>
> > > > yt-users mailing list<br>
> > > > <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> > > > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
> > > ><br>
> ><br>
> > --<br>
> > NEU: FreePhone - kostenlos mobil telefonieren und surfen!<br>
> > Jetzt informieren: <a href="http://www.gmx.net/de/go/freephone" target="_blank">http://www.gmx.net/de/go/freephone</a><br>
> > _______________________________________________<br>
> > yt-users mailing list<br>
> > <a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
> > <a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
> ><br>
<br>
</div></div>--<br>
<div><div></div><div class="h5">GMX DSL Doppel-Flat ab 19,99 Euro/mtl.! Jetzt mit<br>
gratis Handy-Flat! <a href="http://portal.gmx.net/de/go/dsl" target="_blank">http://portal.gmx.net/de/go/dsl</a><br>
_______________________________________________<br>
yt-users mailing list<br>
<a href="mailto:yt-users@lists.spacepope.org">yt-users@lists.spacepope.org</a><br>
<a href="http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org" target="_blank">http://lists.spacepope.org/listinfo.cgi/yt-users-spacepope.org</a><br>
</div></div></blockquote></div><br></div></div>