Chaos Corona Forum
Chaos Corona for 3ds Max => [Max] I need help! => Topic started by: JJG on 2016-04-25, 20:30:46
-
Hey,
I was wondering if it is possible to blend multiple materials together inside of 3ds Max using Vertex Color and something similar to THIS (http://www.gamasutra.com/blogs/AndreyMishkinis/20130716/196339/Advanced_Terrain_Texture_Splatting.php)?
I have to admit I haven't checked indepth yet if something like this is possible using corona. But maybe someone here has already tried or done this before?
-
Nothing you couldn't do with composite map, IMHO.
-
Well, I couldn't really find anything about this online. And granted I haven't tried for very long yet but I couldn't make something that comes even close to the blending there.
Because all I am doing is changing the Vertex Color which is as far as I know just the texture coordinates for the blending ( I have no idea if I have this right ) instead of changing the way the material blend node actually blends.
-
Well, if you have two textures with carefully prepared height maps, then it shouldn't be hard to blend those textures and use height maps as masks for conditional blending. Why you should need vertex colours for that, i don't know. But maybe i didn't understand that article fully - didn't read it carefully.
-
Each of you got part of it correctly :- )
There are two blendings happening here:
1) Vertex color mask (easy to paint and use in real-time) to paint areas where blending between two materials happen, and where not (only base material shows).
2) Height-map mask to blend between two materials. You need at least one height map (the one with more depth ideally of course) for that. The better this heigh-map is, the more convincing is the result, so it's either sculpt based or scan-based. Alternatively, you can derive one from diffuse texture using Quixel NDO/Bitmat2Material/Skald/etc... but if won't be as convincing because it's only guessing the depth.
This is done using standard 3dsMax nodes as Romullus said.
With that said, this technique makes most sense in real-time, because the surface will be rendered only using parallax techniques. In Corona, you can just use displacement of two different surfaces and the effect will happen naturally (instead of vertex painting you can z-height paint directly using polygon brush).
-
Vertex colours are good when you have relatively dense mesh to paint on or when there's a need to have maximum interactive feedback. In other cases i would stick with texmaps.
-
Answer: yes, it is possible with Corona. :)
-
I should have cleared up why I am asking and what I am trying to achieve in the first place.
I am using World Machine to create large scale terrains.
Now with a little bit of setting up, World Machine can provide masks that are then planar mapped onto the terrain mesh that define where a material is supposed to be displayed.
Simplest example would be a slope mask that defines where the cliff material is supposed to go and where grass is supposed to go.
Usually I would end up with around 5 of those masks for 5 different materials.
Up unto this point the whole thing is procedural and works A+ for backrounds especially.
But often times I would like to have a bit more fine control for areas closer to the camera on where the different materials go, so I would use Vertex Paint for that.
I haven't actually checked how to do this inside of 3ds max natively yet. Not sure if you can drag and drop a bitmap into a vertex paint slot to use as a base to later paint over manually.
( Usually I am using game engines like UE4 for this kinda stuff )
And in the end I would like to blend all those materials together using the height based blending approach.
The textures are Photoscanned textures provided by a guy named Christoph Schindelar. And the heightmaps are pretty much top of the line.
I'm real sorry that I haven't provided any actual examples yet ( I kinda don't have too much time lately ) but I will try to post an actual example tomorrow perhabs.
-
As for texture to vertex colours, you can bake that info with vertexpaint modifier. You just have to use scanline renderer for that.
-
As for texture to vertex colours, you can bake that info with vertexpaint modifier. You just have to use scanline renderer for that.
Sounds good to me, I will give all of that a try tomorrow when I am come home from work, and post the results here.
-
I think for what you have described vertex paint modifier + vertex color map will be the base. Then you can experiment with setting different map channels for the vertex paint, baking (as Romullus suggested), mixing vertex map with procedurals to create masks, etc...
-
Just started looking at it again. And right off the bat I think something seems "fucky".
(http://imgur.com/juvU96B.png)
Sand Material
(http://imgur.com/i92zcBT.png)
Forest Ground Material
(http://imgur.com/RCATLR5.png)
Both of them blended together using "Corona Layer Mtl" and a "Vertex Color" node set to map channel 0, as the mask.
Only the albedo seems to be blended. The height and normal seem to only come from the "Forest Ground Material" though.
So, am I doing something wrong right from the start?
-
Displacement is taken from base material only. That's current limitation of layered material unfortunatelly. Bump map should be picked correctly AFAIK. Try to mix displacement at map level instead of material level. Alternatively you can blend everything in single material.
-
Displacement is taken from base material only. That's current limitation of layered material unfortunatelly. Bump map should be picked correctly AFAIK. Try to mix displacement at map level instead of material level. Alternatively you can blend everything in single material.
You could alternatively just decouple displacement to map level (as you suggest), but place it using Disp modifier onto geometry object.
This would retain benefits of layered material (separate maps, easier tweakable).
But by any of the above solutions, you loose the option to easily adjust height of each displacement separately no ? So it's not such an ultimate solution to current problem.
-
But by any of the above solutions, you loose the option to easily adjust height of each displacement separately no ? So it's not such an ultimate solution to current problem.
Well, you can use that same vertex colours map as mask for displacement mix. That should work.
-
But by any of the above solutions, you loose the option to easily adjust height of each displacement separately no ? So it's not such an ultimate solution to current problem.
Well, you can use that same vertex colours map as mask for displacement mix. That should work.
This should easily be possible.
But my head is already starting to spin imagining the node network for a whole bunch of materials blended this way.
I also tried a bunch of different composite maps for all the different materials and I haven't gotten any closer to achieving a similar result to the article I posted at the start of the topic. :|
-
But by any of the above solutions, you loose the option to easily adjust height of each displacement separately no ? So it's not such an ultimate solution to current problem.
Well, you can use that same vertex colours map as mask for displacement mix. That should work.
Well, I know. That's the only way it would work :- ).
But the modifier has only single "height" option (I don't mean relative height of texture map, I mean the physical units inside the modifier, ie. 2 cm). You will have to use this for the material with bigger depth, and adjust the other heightmap.
While keeping displacement map in two different materials, you can keep your texture heightmaps unmodified and adjust each height respectively.
-
Sorry, i didn't read your post carefully enough for the first time. Yes, you're right, this method isn't flexible enough. Oh well, we have what we have for now. Let's hope layered material will be revisited someday :]
Anyway, recorded short video for OP. Just a proof of concept, nothing more:
-
Let's hope layered material will be revisited someday :]
It could be bit more robust. Game engines now offer blend nodes that don't just lerp between two materials, but can 'stack' them (I think this is what the legacy Autodesk composite material was supposed to do ? But does anyone ever used it).
You could then lerp their diffuse/specular properties, but overlay normals.
This can be easily done through nodal network of course, but the charm of more advanced blend node, is that you can keep untouched presets, and mix them into final materials with very artistic, real-world resembling approach. A "dampness" layer, mixed with paving, would overlay normals, and multiply diffuse properties, lerping specularity, without any nodal network at all. Even a 5year old child could then easily create complex blended materials.
One can hope. Or not, when something like "check-box" caused hysteric reactions.
-
Thanks the video is really nice especially for other people who want to do something similar in the future.
Now we have solved the issue of blending the dislplacements correctly and using Vertex Painting to mask the materials.
I am still not any closer to actually blending the materials properly based on height. Doing it in a DirectX material wouldn't be too hard but I am not sure how that would even work with Corona.
And in all honesty. The offline render displacements look so good that anything gained by heightmap based blending would almost be marginal.
On a different note, concering Juraj_Talcik's post.
The material system inside of 3ds Max is kinda meh in all honesty.
I don't mean Corona or Vray, just in general the native 3ds Max slate editor.
Comparing it to something like the UE4 material editor which is essentially just HLSL code presented as template nodes, 3ds Max's material editor is just meh.
Maybe it's my lack of experience working indepth with the 3ds Max material system but to me it feels simply too obscure to make more difficult things with.
-
Alright, here are the blended materials.
Unfourtanetly I just realized that the normals are not blended either so I will have to do that tomorrow since it also just uses the Base Materials normal.
(http://imgur.com/NFrgyOY.png)
-
I am still not any closer to actually blending the materials properly based on height.
Because you are currently not blending with heightmap as mask, but with vertex map. The vertex map, should be used to 'drive' the heightmap used as mask. You started with the latter, from opposite direction than you should have :- ).
....just in general the native 3ds Max slate editor.
Comparing it to something like the UE4 material editor....
We know : /
BTW, fantastic tutorial where I saw this method first is by Aaron Kaminer. It's...unsurprisingly UE4 tutorial that goes a little bit deeper but it's cheap and great. The macros should be (albeit awkardly) replicable in 3dsMax, you just won't create final master shader :- )
https://gumroad.com/aaronkaminer
-
I really need to try UE4 someday, to see if grass is really THAT greener on the other side :]
-
I really need to try UE4 someday, to see if grass is really THAT greener on the other side :]
Some day, in 5 years, where GPUs will be all powerful, real-time antialiasing and GI on same level as offline raytracing, it will be game over :- ) But not yet.
But the material system is really well thought out and nice, with hundreds of nodes for anything. And you can use a thousand of them if you want, it will use more drawcalls, but nothing hindering. Unlike archaic 3dsMax, where bunch of composite and color corrections maps together already start taxing the rendering time. Like...huh ?
-
Alright I followed the tutorial that Juraj posted. One question though, is there someway to "Divide" two maps in 3ds Max? Composite map doesnt have that blend option and I don't see any other way of doing that.
-
Try CoronaMix, it has divide blend mode.
-
Try CoronaMix, it has divide blend mode.
Corona to the rescue :D
-
Here is an alternative for elevation based blending that gives you a ton of control in changing the blends, and allows any number of layers.
Use the gradient ramp map! What many people dont know is that if you right click on the colour flags and select properties, you can actually replace the colours with any kind of map.
Here are the steps I made in my example
1. mapped my elevation with planar mapping in one channel,
2. flip the uvw so it's oriented from top to bottom
3. add in your different colour flags in your gradient ramp map to determine your different levels.
4. add in your textures to each flag on a separate mapping channel, add in additional uvw mapping for said map channel
5. move the flags on the fly to make adjustments!
edit: and if you only want hard line transitions just change the interpolation to solid. <!-- you can change the blend curve here too -->
Obviously the downside is that it can be quite cumbersome once you add in additional gradients ramps for other map channels such as bumps, and reflections. but if you work on it incrementally I think it's manageable
-
Thanks mferster I will try that at some point aswell.
Here is what I have gotten so far.
I am following the guide Juraj posted by the letter, I wouldn't know where I deviate from him.
The result looks different from the normal linear blending for sure, I am just not sure if it really is correct.
(http://imgur.com/Yn5sUiM.png)
(http://imgur.com/UadEpjE.png)
(http://imgur.com/eRP22rR.png)
And last but not least an image of my node graph.
(http://imgur.com/o6vZvpG.png)
I really dont think I am doing this correctly. The water puddle especially just looks a bit wonky to me.
-
Hello there.
I am actually not a Corona or Max user but i think i find a way for this in Maya and vRay.
It schould be possible to do that in other render engines or software pakages where you can render vertex color information.
I also searched for a way for that and the only topic in the whole internet seems to be this topic.
Really strange by the way because this is an really awesome technique.
I made a short video tutorial for that:
t=1s
-
Is this now possible with Corona? It would also be cool if decals can be projected on meshes as well. This is very easy in ue4. There are a lot of things ue4 does efficiently that would save time, need for huge texture sizes and render time overall.
-
Anything (almost!) you can think of is possible with Corona and Max.
Example:
Video:
Scene:
Max 2020 - https://www.dropbox.com/s/srls5b5e779fvqf/vertex-blend.max?dl=1
Max 2017 - https://www.dropbox.com/s/srls5b5e779fvqf/vertex-blend.max?dl=1
Notes:
This is just a quick suggested workflow. I am sure there are better/easier/faster ways to do it.
You can blend between the materials and displacements separately.
You can show some of the mud in brick gaps.
You can show some of the bricks in the muddy areas.
You will have to use your own diffuse and displacement textures (and possibly other maps) because the ones I used cannot be shared.
-
Thanks a lot Maru. I will try this out. If I do find other ways I will post back here :- )
-
Here is another method using 3dsmax osl shaders:
feature=youtu.be
Thanks to Mads Drøschler :- )
-
Chiming in to ask if there has been any significant development on this front?
I don't think it can be reasonably asserted (at this point) that the available solutions for height blending in 3ds Max / Corona Renderer are contemporary with respect to other render engines.
Looking over the provided examples, the solutions that exist for procedural height blending in 3ds Max / Corona Renderer are very complicated, cumbersome, and really echo a much older framework for shading / rendering, but it seems like the major obstacle is actually the implementation of displacement blending across materials in a layered material.
Is there some plugin or set of tools that operate within 3ds Max / Corona Renderer to facilitate layered material blending with displacement? To be sure, vertex paint is not a procedural solution and would not be appropriate for texturing multi-layered materials across a large surface.
P.S. the original post is from 2016!
Some day, in 5 years, where GPUs will be all powerful, real-time antialiasing and GI on same level as offline raytracing, it will be game over :- )
-
I have rudimentary version of height-blending working, but adjustment, error-checking, etc. is pretty cumbersome.
(https://i.imgur.com/gPjwRlr.jpg)
(https://i.imgur.com/yPJAlzo.jpg)
-
I think for what you have described vertex paint modifier + vertex color map will be the base. Then you can experiment with setting different map channels for the vertex paint, baking (as Romullus suggested), mixing vertex map with procedurals to create masks, etc...
hello marcin , i saw you have posted a file on youtube but the dropbox link is giving that the files are delete , can you please reupload the files ,thx!