eidosmontreal / unreal-vdb

This repo is a non-official Unreal plugin that can read OpenVDB and NanoVDB files in Unreal.
Apache License 2.0
691 stars 109 forks source link

Trouble tweaking density based on color values. #81

Closed pierrejacquet closed 1 year ago

pierrejacquet commented 1 year ago

Hello,

First of all, thank you for this amazing plugin, it is really great. I write an issue but I'm sure it's more a need for help. I'm rendering a DICOM (scanner) file through VTK and exporting it to VDB format. All great. But then I would like to tweak the local density based on colors in unreal as I would do in VTK (by adjusting the alpha values). But I'm not sure how to do.

To give a more concrete example. I have a tissue of a patient with muscle, bone and flesh all with different color and density. I would like to make muscle (blue color) for example to disapear. How can I do this. Is it possible ?

I already checked all the issues to see if there is an answer but I didn't find the answer (or I didn't understood). I messed around materials but can't get the result i need.

Thanks :)

thilamb commented 1 year ago

Hello and thanks for the kind words !

I don't think you can do this with the current state of the plugin.

If you have any programming knowledge, it wouldn't be too difficult to adapt the HLSL shader to make it work like you want.

Sorry and good luck !

pierrejacquet commented 1 year ago

Ok thank you for the answer. Keep up the good work !

Andrej730 commented 1 year ago

I think you can do it but you need to use a bit different pipeline. In the example level that comes with plugin there is example for rendering VDB to Volume Texture and drawing it in the world as Unreal volumetric clouds (BP_VdbToVolumetricClouds actor involved).

So, what you can do: 1) Render vdb1 with density to volume texture and then sample it with BP_VdbToVolumetricClouds 2) Render vdb2 with vdb colors to volume texture (I assume here that your colors are also packed in the vdb) 3) Sample second vdb in the BP_VdbToVolumetricClouds clouds shader and use it as mask to tweak vdb1 density