Specular shader chunk


#1

Hello, i want to apply more than one metalic map to a material.
So i can have multiple stripes of “metal” in a model. And also remove them individually.

I added color stripes editing this chunk.

But i cant do the same for this chunk https://github.com/playcanvas/engine/blob/master/src/graphics/program-lib/chunks/metalness.frag

I believe my problem is i dont know what to override.
In the diffuse was this.material.chunks.diffusePS = this.shader_diffuseConstPS.resource.
Of course if a override the diffusePS with a specular gives an error. But i tried specularPS and other variations and it gets ignored.

Clearly i am really ignorant in this topic. But i dont know where to look for more info.

Thanks.


#2

Pardon my ignorance on your project, but wouldn’t it be a bit easier to just have one material with a varying metalness and specular map to fake two or more different metals?


#3

For sure that sounds easier, but how you assign one material with more than one metalness?


#4

Sorry for late response.
This tutorial might help…switching textures at runtime:

Runtime Texture update


#5

I wanted the ability of having more than one metallness texture map.
Finally i used another method.
Still would like to have some example of expanding the specular shader chunk. If someone knows how to do it.


#6

This is a simplified version, but why couldn’t you just vary the grayscale values of each different metal, within the metalness map…like so:


#7

Perhaps it is metalnessPS? I’m inferring that from the references below which are a bit over my head.

and here: