<div dir="ltr">I want to show different parts of one man's head, such as brain, bones, blood vessel, muscle and other tissue, by using color functions and gradient opacity function. As the following pictures of reference software, I can get different effects by adjusting control points, including scalar color mapping, scalar opacity mapping and gradient opacity.<p class="separator" style="text-align: center; clear: both;"><img src="cid:28765e82-4a4c-4592-8c16-69849acfb301" alt="2019-12-25_111721.png" style="margin-left: 1em; margin-right: 1em;" width="320" height="176"><img src="cid:5b5c8fb4-72fe-437c-b03e-73cab3188b72" alt="2019-12-25_111539.png" width="320" height="177" style="margin-left: 1em; margin-right: 1em;"> </p><p class="separator" style="text-align: left; clear: both;">I have run the osgVolume demo of OSG. I try to find any transfer function to adjust effect I want. But I can't find more function besides "TransferFunction1D" and "AlphaFuncProperty". And the member functions of them are too less to realize the effects I want. This is some parts of my code.</p><p class="separator" style="text-align: left; clear: both;"><br></p><pre><span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">ref_ptr</span><<span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">TransferFunction1D</span>><span style=" color:#bec0c2;"> </span><span style=" color:#d6bb9a;">transferFunction</span>;</pre><pre><span style=" color:#d6bb9a;">transferFunction</span><span style=" color:#bec0c2;"> </span><span style=" color:#d6bb9a;">=</span><span style=" color:#bec0c2;"> </span><span style=" font-style:italic; color:#45c6d6;">new</span><span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">TransferFunction1D</span>;</pre><pre><pre><span style=" color:#d6bb9a;">transferFunction</span><span style=" color:#d6bb9a;">-></span>setColor(<span style=" color:#8a602c;">0.4</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">Vec4</span>(<span style=" color:#8a602c;">0.75</span>,<span style=" color:#8a602c;">0.25</span>,<span style=" color:#8a602c;">0.12</span>,<span style=" color:#8a602c;">0.0</span>));</pre><pre><span style=" color:#d6bb9a;">transferFunction</span><span style=" color:#d6bb9a;">-></span>setColor(<span style=" color:#8a602c;">0.5</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">Vec4</span>(<span style=" color:#8a602c;">0.975</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.9</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.82</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.6</span>));</pre><pre><span style=" color:#d6bb9a;">transferFunction</span><span style=" color:#d6bb9a;">-></span>setColor(<span style=" color:#8a602c;">0.6</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">Vec4</span>(<span style=" color:#8a602c;">1</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">1</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">1</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.6</span>));</pre><pre><span style=" color:#d6bb9a;">transferFunction</span><span style=" color:#d6bb9a;">-></span>setColor(<span style=" color:#8a602c;">1.0</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osg</span>::<span style=" color:#ff8080;">Vec4</span>(<span style=" color:#8a602c;">0.9</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.9</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.9</span>,<span style=" color:#bec0c2;"> </span><span style=" color:#8a602c;">0.6</span>));</pre><pre><br></pre><pre><span style=" color:#d69aa7;">float</span><span style=" color:#bec0c2;"> </span><span style=" color:#d6bb9a;">alphaFunc</span>=<span style=" color:#8a602c;">0.02f</span>;</pre><pre><span style=" color:#ff8080;">osgVolume</span>::<span style=" color:#ff8080;">AlphaFuncProperty</span>*<span style=" color:#bec0c2;"> </span><span style=" color:#d6bb9a;">ap</span><span style=" color:#bec0c2;"> </span>=<span style=" color:#bec0c2;"> </span><span style=" font-style:italic; color:#45c6d6;">new</span><span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osgVolume</span>::<span style=" color:#ff8080;">AlphaFuncProperty</span>(<span style=" color:#d6bb9a;">alphaFunc</span>);</pre><pre><pre><span style=" color:#ff8080;">osgVolume</span>::<span style=" color:#ff8080;">CompositeProperty</span>*<span style=" color:#bec0c2;"> </span><span style=" color:#d6bb9a;">cp</span><span style=" color:#bec0c2;"> </span>=<span style=" color:#bec0c2;"> </span><span style=" font-style:italic; color:#45c6d6;">new</span><span style=" color:#bec0c2;"> </span><span style=" color:#ff8080;">osgVolume</span>::<span style=" color:#ff8080;">CompositeProperty</span>;</pre><pre><span style=" color:#d6bb9a;">cp</span>->addProperty(<span style=" color:#d6bb9a;">ap</span>);</pre></pre></pre><div class="prettyprint" style="background-color: rgb(250, 250, 250); border-color: rgb(187, 187, 187); border-style: solid; border-width: 1px; overflow-wrap: break-word;"><code class="prettyprint"><div class="subprettyprint"></div></code></div><p class="separator" style="text-align: left; clear: both;"><br>This is the result of my demo.</p><p class="separator" style="text-align: center; clear: both;"><img src="cid:2a9539e2-8875-4874-a8cb-1d540033396f" alt="2019-12-25_112706.png" style="margin-left: 1em; margin-right: 1em;" width="320" height="221"></p><p class="separator" style="text-align: left; clear: both;"><br></p><p class="separator" style="text-align: left; clear: both;"><br></p><p class="separator" style="text-align: left; clear: both;"><br></p><p class="separator" style="text-align: left; clear: both;">I'm confused with how to get better effect by OSG volume rendering. I have attached the source code file. Thanks.</p><p class="separator" style="text-align: center; clear: both;"><br></p><div><br><br>On Tuesday, December 24, 2019 at 11:58:17 PM UTC+8, Robert Osfield wrote:<blockquote class="gmail_quote" style="margin: 0;margin-left: 0.8ex;border-left: 1px #ccc solid;padding-left: 1ex;"><div dir="ltr">Hi Yuhui,<br><br>On Sunday, 22 December 2019 08:40:00 UTC, Yuhui Ren  wrote:<blockquote class="gmail_quote" style="margin:0;margin-left:0.8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">I have a 3D medical application developed by OSG. I want to realize volume rendering of CT/MRI dataset. Refer to the figure below.  I can set different effects of rendering. I have browse the osgVolume. I find that the transfer functions are too few to realize the effect I want. So what I’m asking really if anybody has any advice. It would be really appreciated, thanks!</div></blockquote><div><br></div><div>I don't know what you are looking for so can't provide any specific advice.  </div><div><br></div><div>What do you mean by "the transfer functions are too few"?  </div><div><br></div><div>What effect do you want?</div><div> </div><div>Cheers,</div><div>Robert.</div></div></blockquote></div></div>

<p></p>

-- <br />
You received this message because you are subscribed to the Google Groups "OpenSceneGraph Users" group.<br />
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="mailto:osg-users+unsubscribe@googlegroups.com">osg-users+unsubscribe@googlegroups.com</a>.<br />
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/osg-users/8aa0e1e8-2463-4b35-acb3-60998b16b356%40googlegroups.com?utm_medium=email&utm_source=footer">https://groups.google.com/d/msgid/osg-users/8aa0e1e8-2463-4b35-acb3-60998b16b356%40googlegroups.com</a>.<br />