friggog / tree-gen

Procedural generation of tree models in blender
GNU General Public License v3.0
827 stars 74 forks source link

Basic materials #56

Open ekswathi opened 3 years ago

ekswathi commented 3 years ago

Can we have basic materials with the addon?

samipfjo commented 3 years ago

My test materials are stereotypical programmer art, so I'll be of no help here. @friggog do you have the materials you used in your demos and, if so, are you willing/able to release them under the license? Or do we want to keep this outside the scope of the plugin? I agree that it would be cool to ship with default materials so beginners can look at pretty trees quickly :)

jayfield1979 commented 3 years ago

I don't really see this as an issue because there are so many freely available sources for PBR textures for bark and leaves.

Also, most artists will want to replace default materials with their own shaders.

However, you could interpret basic materials as meaning something like this:

image

This would be easier for artists to then come and just exchange the material for their own but still get a useful preview at creation time.

You might run into headaches with redistributing textures unless you've created them yourselves.

The only thing you must do is ensure the UV's are ready to go (which they appear to be).

P.s. incidentally, the multiple materials applied to the leaves were created by using the face > select > random and put a probability of 100 / the amount of materials I needed.

friggog commented 3 years ago

I'm generally against bundling textures in with the plugin, but assigning placeholder materials to different parts of the object could be useful as @jayfield1979 suggests

ekswathi commented 3 years ago

I was not talking about textures. Materials for example Just green materials to leaves, red or pink colors to flowers and brown will give a visual impact when we generate the trees. or that is what i think. Just my suggestion to improve this already amazing addon.

friggog commented 3 years ago

There are some procedural shaders around that are pretty cool and lightweight: https://blenderartists.org/t/procedural-bark-material/675774 https://blender.stackexchange.com/questions/96816/how-to-make-a-procedural-white-birch-bark-material-in-cycles https://www.blendernation.com/2019/03/14/download-procedural-pine-bark-shader/

And (possibly with textures): https://reynantemartinez.us8.list-manage.com/subscribe?u=dbfc76cf77f058cc4f3b61f29&id=a816443d80 https://reynantemartinez.us8.list-manage.com/subscribe?u=dbfc76cf77f058cc4f3b61f29&id=1619756e9c

I'm not sure about redistributing these as part of the plugin - we could provide links as part of the Wiki with no problem, or include in the plugin with the creators' permission. Leaves are a lot simpler I think, providing we don't want very high detail (ie leaf textures). It might be nice to spit out a pretty much ready-to-render tree straight away from the plugin, we can also randomly vary the leaf color/bark scale, offset and random seed slightly so every tree is unique

jayfield1979 commented 3 years ago

I can take a look at putting together some simplified bark/branch materials if you like? They'll be much simpler than those from the examples but should be recognisable for the species in your preset list. They'll also be a lot faster to render.

Leaves and needles just need the right balance of solid colour, SSS, and randomisation - very easy with cycles (thanks to random per island). I think Eevee supports random per instance. So at least each tree will look slightly different.

The materials can be configured with some simple user inputs for tweaking of the major parameters.

jayfield1979 commented 3 years ago

This is the shader for the broadleaf trees:

untitled

Pretty simple using basic Blender procedural material nodes.

Close up of the leaves:

untitled3

Applied this to a tree model as it came out of TreeGen. The UV's are a little messed dup on the leaves so couldn't add much detail, and because the trunk is one long mesh that fits inside the 0-1 space, there's only so much I could do with mapping.

Let me know if you like it and I'll send you the .blend file

EDIT: needs a bit more saturation and I'll take another look at the bark shader after my Unreal Workshop.

Hopefullyidontgetbanned commented 3 years ago

for me and i assume for others too, it's much less having the materials but having Easily Accessible uvs, unwrapping from the generated mesh is not practical because every leaf is joined together and at various angles. some leaves do have uvs such as the palm tree but others such as the pine tree and quaking Aspen do not.

friggog commented 3 years ago

@Hopefullyidontgetbanned I think my original idea was that if you need UVs then you are using images for the leaves, so it's reasonable to use rectangle or triangle leaf shapes (which have UVs) and rely on alpha for the actual leaf shape. If you are instead relying on the mesh for the leaf shape then I assumed you'd be using a non-textured material like this posted above, so don't need UVs.

It's certainly possible to add UVs for the other leaf shapes, it just would take some time and didn't seem worth it when I originally wrote that stuff - would be interested to hear about any use cases beyond those I describe above which might mean it's worth doing now.

Hopefullyidontgetbanned commented 3 years ago

@Hopefullyidontgetbanned I think my original idea was that if you need UVs then you are using images for the leaves, so it's reasonable to use rectangle or triangle leaf shapes (which have UVs) and rely on alpha for the actual leaf shape. If you are instead relying on the mesh for the leaf shape then I assumed you'd be using a non-textured material like this posted above, so don't need UVs.

It's certainly possible to add UVs for the other leaf shapes, it just would take some time and didn't seem worth it when I originally wrote that stuff - would be interested to hear about any use cases beyond those I describe above which might mean it's worth doing now.

i completely agree that a generic plane would be ideal for leaves however, you'd still have the issue of some high poly trees not being unwrapped at all which can't reasonably be done after creation (having the uv's on high poly leaves would be useful for many reasons) , if we can swap high poly and low poly leaves as a drop down menu that would also work.

samipfjo commented 3 years ago

you'd still have the issue of some high poly trees not being unwrapped at all

Sorry, I don't understand what you mean, can you clarify?

Hopefullyidontgetbanned commented 3 years ago

you'd still have the issue of some high poly trees not being unwrapped at all

Sorry, I don't understand what you mean, can you clarify?

some trees like the quaking aspen, do not have unwrapped uv's for their leaves but others such as the palm tree have unwrapped uv's for their leaves.