Corona Renderer Forum

Corona Renderer for Cinema 4D => [C4D] I need help! => Topic started by: SharpEars on 2021-02-16, 19:55:54

Title: Using Cinema 4d 3D noise shaders inside of glass
Post by: SharpEars on 2021-02-16, 19:55:54
I cannot for the life of me figure out how to get Cinema 4D noise shaders to working inside basic glass. For example, let's say you are making a basic marble (the sphere variety that kids play with, not the stone).

You start with a sphere and place on it a basic Corona Physical Material with the following changes from default:

Base Layer - Roughness value is changed from 75% to 0%
Turn on Rerfraction - (no changes to defaults)

OK, we now have a simple glass sphere. Now, the goal is to get a 3D Cinema 4D Noise shader inside the glass and not just on its surface.

I will be using the following Noise Shader and settings for this task:

Noise: Hama
Color 1: Pure Black (RGB: 0,0,0) (Should be the default)
Color 2: Pure White (RGB: 255,255,255) (Should be the default)
Space: Object
High Clip: 5% (To make the lines sharp and well defined, helping us determine whether they are on the surface or actually inside the object)
Everything else set to the default

OK, now if I stick the above Shader into the Refraction texture, I get noise on the surface of the glass sphere and not inside of it. This is true regardless of the Space property inside the shader (I tried them all going one by one from UV-2D to raster, and Object is the correct setting for 3d noise, so I settled on that).

Lesson learned: Putting a 3d noise shader into the Refraction texture slot only affects the surface of the object (i.e., sphere) and not its inside

Then, I tried to see if maybe turning on Volumetrics and placing that same Shader into the Absorption Color Texture slot would cause the inside volume of the sphere to take on the noise. (Mix mode was left at Normal and mix strength at 100%. The color was left at a default of 50% gray and is disabled in any case when the Texture slot is filled).

There was no change, the noise only affected the outside of the sphere and the result is attached.

I can't for the life of me figure out how to get the noise to appear, in 3D inside the sphere and not just on its surface.




Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: TomG on 2021-02-16, 20:06:06
All shaders render only a surface, with the exception of the CoronaVolume which when set to Inside Mode actually handles a volumetric material. However it has no surface properties (reflection etc.) since it is a volume.

To be honest, what you describe, a marble as played with by a child, you'd be better modeling it. The CoronaVolume material is more intended for things like smoke, mist, fog, fire, etc. Things that are sharper and more well defined are better off being modeled though.

You might get it to work, ish, using one sphere with the volume material, with most of it being totally transparent (no absorption or scattering) and other parts solid (high absorption some scattering) for the volume, and then another sphere for the glass surface of the marble.

BTW this is true of all shaders, you can try this with native C4D ones too, or V-Ray ones, or Arnold ones, and so on and so forth - unless they are specifically volumetric/volume shaders, they are only calculated at the surface (it takes different calculations to handle an actual volume).
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: TomG on 2021-02-16, 20:09:29
PS what I describe with 2 spheres is for those "swirls of color inside the marble" - it wouldn't work for cracks or bubbles, because those need refraction and reflection, and volume materials don't have refraction or reflection.

And a PPS, turning on absorption etc. in a normal material only gives a homogenous result, that is, color etc. is taken to be the same all the way through the material, so it can account for depth of the material (how much of the material light is passing through) but the material is assumed to be the same all the way through and not varying in 3D space. Heterogeneous volumes that change in 3D space require the dedicated Corona Volume shader.
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: SharpEars on 2021-02-16, 20:14:35
PS what I describe with 2 spheres is for those "swirls of color inside the marble" - it wouldn't work for cracks or bubbles, because those need refraction and reflection, and volume materials don't have refraction or reflection.

And a PPS, turning on absorption etc. in a normal material only gives a homogenous result, that is, color etc. is taken to be the same all the way through the material, so it can account for depth of the material (how much of the material light is passing through) but the material is assumed to be the same all the way through and not varying in 3D space. Heterogeneous volumes that change in 3D space require the dedicated Corona Volume shader.

THIS, THIS is the problem. I would use a volume material for the whole thing, but as you pointed out:

Volume materials don't have reflection or refraction (or an IOR!!) making them only useful for non-solid translucent visual effects like smoke, fire, etc., and not for solid objects like glass or other transparent/translucent solids with actual textured structure inside of them.

This is why I tried to get things to work with a Physical Material and discovered that I can only texture its surface and not its inside volume.

Since modeling Cinema 4D 3d noise would be very painful, I will try your approach of putting a volumetric material inside of a physical material and see where that takes me.
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: BigAl3D on 2021-02-16, 22:11:21
Could you post an image of what you are trying to achieve?

As @TomG said, sometimes is just easier to "model" certain items. Mograph makes this super easy, assuming my example is close to what you are trying to get. What about this? Simple tiny (.10) sphere in a Cloner. Set to Object, Surface and Volume. Random Effector with only Size enabled and set to .7 I think. Scene file crashed. I used your formula for the glass, but used the Diamond preset for the bubbles, otherwise, they disappear if the refraction is the same.
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: SharpEars on 2021-02-17, 23:22:05
I used your formula for the glass, but used the Diamond preset for the bubbles, otherwise, they disappear if the refraction is the same.

The bubbles disappear probably if you don't make their normals "inside-out" . That is their "blue" sides should be towards the outside and their "yellow/orange" polygon sides should be towards their respective centers.

Here is a picture of something like what I am trying to achieve (from an item being sold on eBay). Notice the translucency and blurriness of the white swirls inside the marble:

(https://i.ebayimg.com/images/g/-XQAAOSwC~tdWuCc/s-l1600.jpg)
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: BigAl3D on 2021-02-18, 00:14:25
Since you said noise, I thought you were looking for the bubble effect.
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: Cinemike on 2021-02-18, 01:44:08
I'd go with TomG but use one sphere with a layered material.
Warning: We are now leaving the realm of exact physics and enter fake territory!

Create a standard glass material and increase its IOR to around 3 to make up for what we will do next.
Create a volume material with "inside volume" active, tweak all parameters to what you like (I used a noise in 3D space).
Create a layered shader. The volume shader is the base material, in the 1-slot put the glass material. Set Amount to 1.
That's it.

It's probably (very likely) not correct but might look the part.
The second image uses a glass material with a standard IOR of 1.5. You see the glass lacks a real volume because of the used volume material ;)

I hope this helps a tiny bit.
Michael
Title: Re: Using Cinema 4d 3D noise shaders inside of glass
Post by: burnin on 2021-02-18, 17:26:57
Same thought, but here Volume is  fully overlaid (Amount: 1) by Physical Glass preset material.

:) "No magic, just science."

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=32442.0;attach=142922;image)

Aaaaarhg... and it renders fast!

(https://forum.corona-renderer.com/index.php?action=dlattach;topic=32442.0;attach=142924;image)