Already new standard material, based on NodeMaterial?

I had a look at the node material today and it fascinates me. Is there already a new version of StandardMaterial that is based on a node graph? I would like to create a derived version but re-use e.g. the shadow map capabilities of StandardMaterial.

Got a pointer for me, please?

Iknow @Deltakosh did and I bet he ll be happy to share it tomorrow after the break.

What do you mean by break? Which break? On which occasion?

I’m not an expert, but I can mean “rest”. Or I need to look better at the definition of the word “break”

Generally people take breaks after hard work. I think he has the right to rest like everyone else.

Do you really need a special occasion to take a break?

1 Like

I was asking because @sebavan said “the break” which sounded like a certain, well-known, break to me. Could be a break in a regular webinar or some other occasion, that’s why I asked for the occasion. Maybe, I am missing some occasion that is well-known to this community.

On the other hand, I heard that the U.S. have “labor day” today, so maybe that’s what he means by “break”.

Never mind…

Me, I have breaks every day, because working always, it’s good 5 minutes. :smile:

1 Like

Hi guys. Mattes3… you might be able to do some play… here:

This is the 8th version of the first playground that Deltakosh showed us… in his “sneak peek” thread.

I fixed it up… adjusted a few knownValues vs. systemValues… removed a whole lot of mesh, and got it working on a simple box. (it wasn’t difficult at all, really)

Line 77 is where the nodeMaterial is applied to the box.

I think… just push the large EDIT button on the right (on the inspector)… and you should see the NME launch with a flowView of the current red box material. I changed the box color to green, and it worked… so other things might work, too.

The NME is pretty much alpha-ish and still well under dev… so… um… perhaps keep future playground saves that WE do… all within the #4I3SIR series. That way, when things change in the NME, we don’t have lots of playground series to fix. Instead, they will all be within the #4I3SIR series.

I don’t know if it can still be called a “standardMaterial”… but it’s darned close to being one. :slight_smile:

Potentially stupid statement by Wingnut: All BJS materials, standard or advanced… are made from shaders and post-processes… behind the scenes. If correct, we ARE seeing a fairly accurate flowView of a bare-bones standard material… in the above playground. Most of us… just have never seen its shader code… represented in a flow-view way, before now. I could be completely wrong, though. :slight_smile:

Party on!

1 Like

@mattes3 By break I meant week end + labor day indeed :wink:

Hi @Wingnut,

thanks for the playground. By “standard material”, I mean: can it receive shadows, i.e. using the usual ShadowGenerator, and: does it support specular lighting?

Or, are shadows and specular lighting each “just another node”?

Anyway, sounds like it’s time to throw away my custom ShaderMaterial and replace it by a NodeMaterial. :slight_smile:

Ahh… ok, sorry I misunderstood about that. Yeah, those are excellent questions you raise. Let’s listen to comments from the pros (like you). :slight_smile:

Are you going to test some speculars and shadows on the above PG series? Teach/show us what you learn, ok? Perhaps we need to wire-up some light nodes to the box material? Got the docs memorized? :wink:

YOU might be the #1 or #2 expert on this new system, at this time. If you go experimenting… please teach us what you learn. thx!

I went into the editor and clicked “Export shaders”. The shader code that was generated by the NodeMaterial shows that lighting is not included but has to be modeled using more nodes. When I saw that, I thought “duh, of course!”. (So, forget my stupid question from above).

So, what I need is a simple example how to connect a NodeMaterial to a ShadowGenerator. I think, the rest will be quite easy. :slight_smile:

1 Like

Hey:) it will be automatically done:) as long as you add a light node, the node will take care of the shadows as well and if your light has a shadowgenerator then magic will happen;)

In a nutshell, wiring a light node is all that you need:)

Hey :slight_smile: this comes in handy! I am just in the middle of tinkering with it. The light node wants a world position input – where do I get it from? is it the world position of the light itself?

It is the world position of the mesh position. You should already have it for the vertex output (mesh position transformed by world matrix)

Oops, suddenly my node editor window is gone. When I click “Edit”, it does not re-appear.

Try reload:) if you can repro I’m interested by your save file

Wow, in the editor I have created this node graph. Worked well!

The box looks green with specular lighting, as expected.

HOWEVER: When I generate the code and put it back into the original playground, I see a black box instead of a green box.
See here:

How come?

What I need now is a node for which I can write the shader code by myself. Example: Height-dependent colors for a terrain, done in the fragment shader.

Is there a (kind of) “generic” node?

Found something: In the code further down, the specular color is set to black. When I set it to white, the box becomes green.

light.specular = BABYLON.Color3.White();

Yep no need for more. Your specular was just black :slight_smile:

Regarding custom shader code node. This is not the goal of the node material. You can write it using other nodes.

For custom shader code you need to get back to the ShaderMaterial (where you can use includes to get some code done for you though)