Ambiera Forum

Discussions, Help and Support.

Ambiera Forum > CopperCube > Feature requests and bug reports
Pallete swapping (hlsl shift)

just_in_case
Moderator
Quote
2019-12-07 15:31:39

a new node specific shader or material which can be used to swap palletes during runtime.

right now am trying to create a clone of rts game age of empires and as its a team based game and contains lots of textures and sprites for one single team.

so here comes the need of this shader or material to create n number of teams without loading different textures or images. just clone the node and change their shader with the new material or pallete.

for example clone scenenode "unit_Villager" and then something like ccbSwapPalleteColor("original_rgb value or color", "new_rgb value or color") will change for example blue ( original color) to Red (new color)... all we need is to specify the rgb value to change.

this will be really helpfull for creating team based games. in which we don't have to load textures for other teams all we can do is used the previously loaded textures from the memory and tweak their color.

I tried developing it by myself but shaders are not my cup of tea. so if anybody else can develop a shader to swap shift hlsl (color pallete) then it will be really great, might be usefull for other users too.


carlosm
Registered User
Quote
2019-12-09 12:31:36

Hi, I didn't get it right.
But you want a javascript code that clones a "node" but changes its color at random? or adjustable?
in case the color of the texture?

@Robo has a code for dynamically adjusting Rgb colors.


just_in_case
Moderator
Quote
2019-12-09 14:01:09

@carlosm I think you didn't get it , i don't want to change the the color of whole texture, i know i can do that using the ccbscenenodematerialproperty..... i want to change specific color in a texture changed to a different color.....

for example a texture has a soldier with blue dress, now i want to change the blue color of his dress without affecting the body and other color parameters....this can be done using pallete swapping by changing the blue color of the texture to something else. only the blue color will be changed..... According to me this can be done via shaders.... but as i have mentioned scripting shader is not my cup of tea.....

i don't know about @robo's code if he had the code which can do pallete swapping then it will be really helpfull if he share it with the community.


carlosm
Registered User
Quote
2019-12-09 22:36:06

wrote:
@carlosm I think you didn't get it , i don't want to change the the color of whole texture, i know i can do that using the ccbscenenodematerialproperty..... i want to change specific color in a texture changed to a different color.....

for example a texture has a soldier with blue dress, now i want to change the blue color of his dress without affecting the body and other color parameters....this can be done using pallete swapping by changing the blue color of the texture to something else. only the blue color will be changed..... According to me this can be done via shaders.... but as i have mentioned scripting shader is not my cup of tea.....

i don't know about @robo's code if he had the code which can do pallete swapping then it will be really helpfull if he share it with the community.



@just_in_case.

I found this on the web.

https://gamedevelopment.tutsplus.com/tutorials/how-to-use-a-shader-to-dynamically-swap-a-sprites-colors--cms-25129

I hope it helps !!!


Aiming_bullets
Guest
Quote
2019-12-11 04:41:51

Can you please post a video or some screenshot of what you have acheived? I love your work, you are the wizard of coppercube engine. Curious to see what your clone looks like. Am pretty sure it mimics the exact same copy of the original AOE are you working the ai too? And you said that you are creating it in 2D right it seems really difficult work to create something like age of empires with coppeecube.

If you can post some screenshot or videos?


Aiming_bullets
Guest
Quote
2021-07-21 05:02:38

It is really interesting to see someone who requested a feature and then develop the same, you request a color-replacing feature and now you created this feature on your own. Amazing!!


just_in_case
Moderator
Quote
2021-07-21 10:24:24

hehehe, Thanks! Yeah I remember requesting the feature and am glad that shaders are now becoming ingredients of my Tea


DouweDabbe
Guest
Quote
2021-08-24 06:07:28

does this work in coppercube for android:


Using Lookup Tables (LUTs) for Color Grading

https://lettier.github.io/3d-game-shaders-for-beginners/lookup-table.html


just_in_case
Moderator
Quote
2021-08-24 07:53:53

I am not into GLSL that much or don't know about android shader languages but I think you can also do this with a 2D overlay to add tint to your game.
For example create a full screen 2D overlay with some alpha background color and hide or unhide it during runtime, that might also work on android devices.

As for now, i am still trying to figure out how to apply screen shaders in Coppercube as for now it only provides option to apply shaders to individual nodes.


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Inte?national" (you are not logged in)


Text:

 

  

Possible Codes


Feature Code
Link [url] www.example.com [/url]
Bold [b]bold text[/b]
Image [img]http://www.example.com/image.jpg[/img]
Quote [quote]quoted text[/quote]
Code [code]source code[/code]

Emoticons


   






Copyright© Ambiera e.U. all rights reserved.
Privacy Policy | Terms and Conditions | Imprint | Contact