Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Slime color change #5

Closed
RustyNeuron opened this issue Apr 27, 2021 · 12 comments
Closed

Slime color change #5

RustyNeuron opened this issue Apr 27, 2021 · 12 comments

Comments

@RustyNeuron
Copy link

Hello, Sebastian or anyone reading this, so in the video you can see slime with different colors, how do I change them in the simulation? In the Simulation script I saw an unused colourMapTexture, is this it? Also there are Trail Map, Diffused Trail Map and Display Texture, what do they do? I'm a newbie in Unity, very limited knowledge on shaders and only "ok" programmer, any answers would be appreciated.

@JaFeRo
Copy link

JaFeRo commented Apr 27, 2021

My experience is only a half step above yours, but I found the proper settings, for you and anyone fiddling around with this cool project. https://imgur.com/a/l0dwCde

@RustyNeuron
Copy link
Author

My experience is only a half step above yours, but I found the proper settings, for you and anyone fiddling around with this cool project. https://imgur.com/a/l0dwCde

Yeah, I knew about settings, the format change that you also showed actually doesn't do anything for me unfortunately, but I think it's just a setting for a bit depth and the format of the map or something like that, I don't see how that setting would change color of the simulation on it's own.

@JaFeRo
Copy link

JaFeRo commented Apr 27, 2021

ok, sorry yeah you are right it does not properly edit the colors as I initially believed when I tested it.

But I found a way to edit the colors here is how I did it:

In the folder "Materials", there is just the file "New Material (Material)". Create a new material and select Material. Under Shader select "Particles", "Standard Unlit". Now you can edit the color of this material, when you are done, under the Simulation select Quad and there you have "Mesh Renderer" where you can select the Material you want to use, select your new one and it changes the color of the simulation.

Edit
This also works under some very specific conditions I just realized, but it does work if you only use one Element and select the R32G32B32_S Float Format. https://imgur.com/gallery/DSyAhDH

@markmacode
Copy link

but it does work if you only use one Element

Has anyone found a way to change the individual color for multiple slime elements? It would be nice if we could just chose the RGB value for each element in the Species Settings on the Simulation object.

@kheremos
Copy link

kheremos commented Sep 1, 2021

I've spent a lot of time working with this, and unfortunately it looks like colors are basically hard-coded. They use the RGB channels as masks, so even if you do figure out how to add different colors, it would change the behavior of the algorithms. A "mixed color" would have to have a custom detector, and a "pure color" would be partially drawn to a mix color. This is also why you can't really get more than three active species at a time.

I'm not 100% on the above, but at this point it's the conclusion I've reached. Sorry @mark-bromell

@markmacode
Copy link

Thanks for looking into it @kheremos. I also came to the same conclusion after working on it for a while.

For future reference to anyone exploring this topic -- Currently there is no known easy way to change the colors of the slime elements.

@SebLague
Copy link
Owner

SebLague commented Sep 3, 2021

Hi, I've just added support for changing colour per species. Let me know if that works for you!

@pat-mw
Copy link

pat-mw commented Sep 5, 2021

Hi @SebLague -- I've just tried the new push and for me it seems like the colours don't work. Everything is just black and white despite tinkering with the species settings.

image
image

@markmacode
Copy link

@pat-mw It works for me, but I made some mistakes when testing it out in the beginning. There could be two things happening that I can think of

  1. If you're using Linux, make sure that you have Vulkan enabled, Sebastian outlined how to do that here.
  2. Make sure that the "Show agents only" setting is unchecked on the Simulation object. When this setting is enabled it removes any extra rendering effects to the slime elements, it only displays them as a single white pixel.

@kheremos
Copy link

kheremos commented Sep 7, 2021

Thanks @SebLague you're amazing!

I've been trying to turn this into an app that I can share with my young nephew. He's autistic and I'm hoping that the moving colors and patterns may intrigue him. Of course, he'll probably just exit the app and open Netflix. But it still seems worth it.

Your color solution is elegant, and I'd have responded sooner, but I had to tie it into the UI I've built, so didn't really get to test it until today. It's excellent.

If I can figure out what's causing some of the render issues people are experiencing, I'll share more advice. (I think there's some functions that don't work well with OpenGL ES)

Thanks again!

@pat-mw
Copy link

pat-mw commented Sep 8, 2021

@pat-mw It works for me, but I made some mistakes when testing it out in the beginning. There could be two things happening that I can think of

  1. If you're using Linux, make sure that you have Vulkan enabled, Sebastian outlined how to do that here.
  2. Make sure that the "Show agents only" setting is unchecked on the Simulation object. When this setting is enabled it removes any extra rendering effects to the slime elements, it only displays them as a single white pixel.

Thanks man! It worked :)

@SebLague
Copy link
Owner

SebLague commented Sep 8, 2021

Great, I'm happy it seems to be working! Will close this issue then.
That's really nice @kheremos I hope your nephew enjoys it :)

@SebLague SebLague closed this as completed Sep 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

6 participants