Setting Gradient in a NodeMaterial

Which pg are we talking about?

reset function - doesn’t work:
If it works try to hit Play again, it will fail.

refresh rate change - works:

or a simplified versionm but still using the refresh rate property - works:

EDIT:
Buddy, this is driving me crazy. And once again after I opened multiple tabs with these PGs it’s behaving weird… Even the ones which are working correctly when running w/o any other PGs open… :crazy_face:

I was mentioning this. However it didn’t help in this case:

Wow - I went to sleep and then just started up and this has turned into a huge thing. Yes it was frustrating me too - If I wait a period before doing texture.render() to update (200ms seems to work most of the time - but not always), It would update the colours, but the less time I wait the more often it will fail.

Thanks for looking into this guys. I may have to take another approach though :frowning: as I kind of need it to be instant, and it flickers when I change gradient colours - the user can drag across a colour box to set this and its flickers all the way; maybe fixing this will fix it though.

1 Like

Thanks for all your help - I tried all the methods that seemed to work in your playgrounds; but none worked in my setup. Maybe the PR will fix things once they do the next release.

If you want to see the state it was a few days ago (working but flickering) you can look at the whole project here; http://mc.mindlessbrain.com/

click on ‘new material’ and add a ‘noise’ node, click on that and then the colour boxes to change the gradient.

Thanks for your help - I guess I’ll just wait till babylon is updated.

1 Like

This is so cool I didn’t even realize that I’ve been playing with this app for 30 minutes already! :heart_eyes_cat: Were you inspired by Substance Painter?

I’ve noticed one thing which kills performance a lot. When you change the sliders:

you immediately recreate the meshes on every change. You should debounce the function you call.


The moment when Teramind (employee screen monitoring) starts to yell at you for watching inappropropriate content on your company PC:

:smiley:

1 Like

lol - yes the modeling parts I have rewritten about 5 times now and lost lots of models in the process. I used an early version it to make a castle pack for unreal engine…that I never released.

One day I’ll put all these model templates back in.

Every time I add something new I get stuck playing around with it for ages! Thanks for the feedback and help!

1 Like

I watched the video on youtube. Looking cool! Did you lost all of these assests?

oh - a little bit substance painter, but its meant to be simpler to use; pre-built templates you can alter through sliders. A bit more like daz3d.

The material stuff is more like quixel mixer. I’ll update at the end of the week then its back to paid work :frowning:

no they are around somewhere - just wasn’t happy with the overall quality and wanted to rewrite MindlessCreator to be easy to use…and then I got a paid job…

1 Like

What about:

This is my dream too.

well I quit a bad job…and then got a bunch of contracts; better pay and more time to live that dream…sort of going…ok…

2 Likes

Hopefully my fix will fix it:) the public version will be available tomorrow

thats a quick turnaround - thanks!

1 Like

I just updated babylon to 7.20.1

It doesn’t look like the gradient issue was fixed - but maybe I’m doing it wrong? What is the correct way to update the gradient for a GradientNode ?

and if you can demonstrate with this playground (currently crashes)

Any of these?

Another example:
Babylon.js Playground (babylonjs.com)

With

var colorSteps = [];
colorSteps.push(new BABYLON.GradientBlockColorStep(0, new BABYLON.Color3(0.03, 0.05, 0.12)));   
colorSteps.push(new BABYLON.GradientBlockColorStep(1, new BABYLON.Color3(1, 0.91, 0.24)));

gradientBlock.colorSteps = colorSteps;

Must be something about my setup but none of these work still.

I did a video below showing what is happening. I think there must be some fundamental thing I am doing wrong!

The thing is its hard to create in a playground as its gotten very complex - I use the output texter once it has render as the input to another shader; so I need to know it has had the material rebuilt and the texture render completed before I send its output on to the next stage.

Everything works except this gradient update.

1 Like

Can you try this approach which changes the refreshRate?

    procTexture.onGeneratedObservable.add(() => {
        procTexture.refreshRate = 0
    })

    nodeMaterial.onBuildObservable.add(() => {
        procTexture.refreshRate = 1
    })

I am so close, but not quite there and I am stuck again.

So I still could not get the gradient to update with any certainty using all the methods in this thread. I have updated babylon to 7.20.1

I am trying a different approach and tearing my hair out again - something is not making sense and I can’t figure out what.

I am using a gradient texture - I create a dynamic texture with the gradient running across the texture. I then use my noise value as the x (or ‘u’ in ‘uv’) lookup on the texture node to get the color in the gradient.

But it just does weird shit.

I get the noise from the perlin noise node add 1 to it and halve it to get a vaslue from 0-1 (I think).

and then I create a uv vector2 with x as the output from above and 0.5 as the y(v) value.

Is there anything wrong with this approach? The gradient seems to update immediately, which is what I want, but the noise changes colour, but does not seem to map correctly.

when I simply make a color out of the noise output (by vectormerger with the noise output on x,y,z) it looks like a nice perlin noise texture. I must not be understanding something.

Any ideas?