GallowayLabMIT / zstacker

Utility function to convert z-stack of images into an OpenVDB file format
MIT License
3 stars 1 forks source link

vdb file does not render in Blender #1

Open jhd4999 opened 1 year ago

jhd4999 commented 1 year ago

When I load my vdb file into blender it appears visible in the solid viewport shading, but disappears when I switch to render using cycles. I also get the following message in command prompt when I use zstacker:

TIFFReadDirectory: Warning, Unknown field with tag 65200 (0xfeb0) encountered. TIFFReadDirectory: Warning, Unknown field with tag 65200 (0xffdc) encountered. Opening TIFF

meson800 commented 1 year ago

Those are just warnings, if it's microscopy data the microscope is probably just using non-standard TIFF tags to store some metadata. If you see the object in the viewport then it created the VDB file correctly.

What does your Cycles node graph look like? You have to assign a material to the volume shader for the proper volume rendering to work. At simplest, you could just map something to the density entry and make sure you light the scene appropriately. If you want to go wild, you can make whatever material you can imagine, like in this example: https://blender.stackexchange.com/questions/202920/openvdb-file-and-blender-cycles

jhd4999 commented 1 year ago

Hi, thank you for the quick response! Here's what I'm working with. I'm not exactly sure what module I would use as an input to the density node of the principled volume. I am also confused as to how multichannel images are processed using zstacker; is each channel processed separately and brought into blender as a separate vdb file? What I'm working with now is just a simple one channel image. The screen capture is showing the solid display mode, when I switch to rendered the object disappears.

Blender screencap

jhd4999 commented 1 year ago

Hi, thank you for the quick response! Here's what I'm working with. I'm not exactly sure what module I would use as an input to the density node of the principled volume. I am also confused as to how multichannel images are processed using zstacker; is each channel processed separately and brought into blender as a separate vdb file? What I'm working with now is just a simple one channel image. The screen capture is showing the solid display mode, when I switch to rendered the object disappears. [cid:72b3c99f-601c-4484-9794-49966a338ca9]

John Day

Grad student MIT BioEngineering


From: Christopher Johnstone @.> Sent: Friday, May 19, 2023 12:51 PM To: GallowayLabMIT/zstacker @.> Cc: John Hickox Day @.>; Author @.> Subject: Re: [GallowayLabMIT/zstacker] vdb file does not render in Blender (Issue #1)

Those are just warnings, if it's microscopy data the microscope is probably just using non-standard TIFF tags to store some metadata. If you see the object in the viewport then it created the VDB file correctly.

What does your Cycles node graph look like? You have to assign a material to the volume shader for the proper volume rendering to work. At simplest, you could just map something to the density entry and make sure you light the scene appropriately. If you want to go wild, you can make whatever material you can imagine, like in this example: https://blender.stackexchange.com/questions/202920/openvdb-file-and-blender-cycles

— Reply to this email directly, view it on GitHubhttps://github.com/GallowayLabMIT/zstacker/issues/1#issuecomment-1554898378, or unsubscribehttps://github.com/notifications/unsubscribe-auth/ATO3SXLZAPLK5Y5D7FONVJLXG6QKBANCNFSM6AAAAAAYIAAFWQ. You are receiving this because you authored the thread.Message ID: @.***>

meson800 commented 1 year ago

So zstacker outputs four grids for each color into the single VDB File; you can see the grid names on the right (channelA for alpha, channelB, channelG, channelR for RGB). Imagine each grid as effectively just a 3D matrix.

If you are using the principled volume, you can map one of these grids onto a value. For example, the density attribute says "density", which means it sets the volume density when rendering to whatever the value of the density grid is (which doesn't exist). If you have a single-color red image say, if you type channelR in that density, then it will use that grid to set the volume density.

Doing this will get you gray clouds; you might have to tweak a lighting setup until you get something you like. By tweaking the color (reflection) /absorption color/emission color, you could e.g. make the cloud glow, etc. For the example movie, I just set the emission color and tuned up the emission strength to make it kind of look like fluorescence data.

meson800 commented 1 year ago

I will note that you can use other Blender nodes to do a lot of tweaking. For example, from the linked stackexchange answer:

image

you could, say, use an attribute node (set to channelR) piped into a ColorRamp node to reduce background, then pipe directly into the density node on PrincipledVolume.