Improve Cycles/EEVEE For Procedural Content Creation

Thought I’d add another website for inspiration. This is a good one that I’m surprised I didn’t mention before. It’s quite the rabbit hole full of links and references to various papers and other algorithms to explore.

The Book of Shaders

3 Likes

This is probably out of the scope for this thread, but material layering is a huge issue, at least when compared to substance.

First, materials themselves are not nodes, so if you maintain a material library intended to be appended used in material layering workflows, you need to wrap it in a nodegroup, and keep a nodegroup of each one. Not a big deal IMO but a smarter way would be better

Then it’s time to layer the materials. You could mix several shaders and that would be pretty easy, but it creates shader redundancy and that slows downs performance. It’s considered bad practice if they’re truly not two different shader types.


So if two materials have the same shader type, like Principled, then it’s recommended to layer the channels/textures of the materials before they pass through the shader. This is what programs like Substance do automatically under the hood but in Blender you have to manually, that’s a lot of clicking.

Of course this is an absurd example, materials don’t usually use each channel, and if you do it manually you will only mix the ones you need, but in this example there are just two materials, common material layering workflows can have more than 10. If you use nodegroups and nodewrangler, you can automate the process a lot without having to plug the wires manually for each pair of channels.

But ideally, mixing materials should look as simple as it does in the first image, while under the hood doing what the second image does. Maybe what we need is a more generic way of combining different channels into one socket, and not be limited to just float, color, vector3 and shader sockets

17 Likes

Honestly, I think that Cycles already does this to some degree. I did testing of mixed BSDFs and the performance is not nearly as bad as in other mainstream renderers. I suppose you are talking about something like “make material attributes” in UE4, but it really looks like Cycles is already doing it under the hood, at least a bit.

1 Like

This is more noticeable in Eevee compile times and pbr texture painting

Is there any chance for randomness in the brick height and width of the Brick texture node as well as hexagonal or triangular tiles tile??

1 Like

Hi Omar,

I think it is great to add a complete set of basic noise types to Blender, as more complex ones can be derived from those (like the Cinema 4D textures suggested in the RightClickSelect thread).

I suggest using a very nice library for noise generation, called FastNoise.

The main version is written in C++ and MIT-licensed. It includes many classic noise types, like Perlin, Simplex and Worley (sometimes called Cellular or Voronoi). It can also recursively apply details as fractal options (like Blender’s Musgrave noise). Even better, for most types it has hand-optimized code for 2D, 3D and 4D versions:

https://github.com/Auburns/FastNoise

There is also a SIMD-optimized version, but only for the 3D version of each noise:

https://github.com/Auburns/FastNoiseSIMD

With some minor modifications (albeit impacting performance), some of its noise types can be made tileable too.

I think it would be an awesome addition to Blender!!

2 Likes

I am not very familiar with this, so lets see what Brecht have to say about this.

Probably not in scope.

Can you provide some reference?

This have been suggested before. We will look into it.

I am familiar with this library, it is what Animation Nodes uses for noise. However, I don’t think it would be feasible to utilize it. Noise also have to be usable on GPUs, OSL, and OpenGL; so using a C++ library would make noise unusable on all backends but CPUs. We can still aspire to achieve similar performance though. :smiley:

I see, but are you willing to reimplement from scratch all those noise types? In which language?

I believe that implementing noise functions is not straightforward, as each algorithm has subtle details. Moreover, If you’re not careful, numerical issues can introduce visual banding or rounding artifacts.

And there’s also the extra effort to make correct code to be also efficient. :slight_smile:

It seems that OSL has built-in noise functions too (Perlin, Cell, Simplex, Gabor, …), from 1D to 4D. Perhaps this can be used as reference to implement compatible functions for other targets?

Regards!

2 Likes

I mean, yah, this is why I am here :smiley:. The noise will be implemented in SVM, GLSL, and OSL. We will try to use the built-in noise in OSL if we can.

3 Likes

Hey Omar.

One important thing that I just remembered!

To be able to assign random values based on isolated geometric elements, I will explain:

Right now we can assign random values using the Object Info > Random, and that’s ok if you have separated objects, but there is no solution right now to apply Random values using, for example, the Geometry Node, to separated elements inside the same object, see the picture attached:

Since the OBJ-1 and the OBJ-2 are separated Objects they get random color, but the OBJ-3 includes both geometries, even when they are separated geometries, but they are inside the same object, and there is no way to assign random values without a complex work using different vertex colors and similar workarounds that are not always useful.

So a Random or something similar in the geometry info, or in a different node, that allows us to assign different values based on isolated geometry inside the same object could be awesome, this could massively help with things like Clumps of grass or other things.

What do you think?

Cheers!

18 Likes

I think that this is a nice idea and could be useful indeed. I am not sure if the developers agrees, but I will look into it.

I will be working next on textures, so this will have to wait for sometime until I make some progress on textures. I will get back to you :slightly_smiling_face:.

4 Likes

Awesome.

Think that for example this could be a massive leverage to work with Instances and Instanced Collections with that have one object with multiple small sub-elements, as I said, grass clumps or trees, to avoid having a ton of small objects, this will give random values to be able to have just 1 object with X millions polygons, but at the same time it will give a random value per sub-element, so even in the case you have the same tree duplicated you will give a totally different tree becasue the tree leafs will have different values in the shader, adn that random may be multipled with the Random of the Object Info, so you get double randomization :slight_smile:

Hope you can do it and devs see the massive benefits for so many things :slight_smile:

Cheers!

3 Likes

:heart_eyes: This would be amazing for trees for example, where all the leaves are part of the same object but still are independent meshes, to be able to randomize their color without separating them into individual objects.

5 Likes

I was about to hint at the same thing

This has been requested twice on RightClickSelect actually!

  1. https://blender.community/c/rightclickselect/thdbbc/
  2. https://blender.community/c/rightclickselect/NBcbbc/

I’ve personally also ran into issues not having this functionality. Whether this fits into the project, I’m not sure, but I certainly would love to see it.

3 Likes

I think it fits because without this separation how could we create procedural content when an object has several separated parts???

1 Like

Do you think we could have a time node with the following:

  • Time (absolute, in seconds)
  • Time (wrapped 0-1, essentially just Time % 1, but very convenient for procedural or animated materials). Instead of being fixed at 1, perhaps the modulo divisor could be exposed in the node for convenience.
  • Frame number

I know we can keyframe any value, but sometimes you just want to access the time directly instead of animating values. It is also common to use time in shaders for games etc, so it would be nice from newcomers to Blender.

4 Likes

Hey,

  1. Is possibility to make displacemnet(+tesselation) working on EEVEE with nodes?
    Animating procedural texutures with deforming mesh would be awesome!

  2. Second whish in node Texture Coordinate - Object type, not working with EEVEE, but in Cycles yes.

  3. Is the way to make proper ‘Camera projection’ with nodes and textures? In videomappings projects needs this all the time but Blender have only a trick with UVs (‘Project with view’) and this is no realtime and procedural nodes.
    Proposal:

2 Likes

You can just use a driver as suggested above.

Probably out of scope.

I suppose we can implement that. Will look into it.

1 Like

The problem with the driver approach is that we can’t manipulate time easily in the material node.
For instance - there is no way to offset an animation sequence with a random input.

1 Like