Ambiera Forum

Discussions, Help and Support.

Create a new account, Search, or Login:
Name:  Password:
Ambiera Forum > CopperCube > Feature requests and bug reports
Pallete swapping (hlsl shift)
Author Text

just_in_case
Registered User
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
Registered User
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
Registered User
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


Create reply:


Posted by: (you are not logged in)


Enter the missing letter in: "Internat?onal" (you are not logged in)


Text:

 

  

Forum 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