Skip to main content
added 131 characters in body
Source Link

Firstly it's generally referred to as cycling (pallet cycling), so that might help your Google-fu.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach, using shaders, would be to actually produce colour indexed images with a pallet texture. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets.

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize the pallet across all the images) or give each image it's own pallet. That would give you more flexibility but use more memory. Of course you could do both, also you could only use pallets for the things you are colour cycling. Also work out to what extent you wan't to limit your colors to, old games would use 256 colors for example. If you are using a texture then you will be getting the number of pixels so a 256*256 will give you

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets.

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize the pallet across all the images) or give each image it's own pallet. That would give you more flexibility but use more memory. Of course you could do both, also you could only use pallets for the things you are colour cycling.

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

Firstly it's generally referred to as cycling (pallet cycling), so that might help your Google-fu.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach, using shaders, would be to actually produce colour indexed images with a pallet texture. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets.

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize the pallet across all the images) or give each image it's own pallet. That would give you more flexibility but use more memory. Of course you could do both, also you could only use pallets for the things you are colour cycling. Also work out to what extent you wan't to limit your colors to, old games would use 256 colors for example. If you are using a texture then you will be getting the number of pixels so a 256*256 will give you

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

added 131 characters in body
Source Link

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets.

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize the pallet across all the palletsimages) or give each image it's own pallet. That would give you more flexibility but use more memory. Of course you could do both, also you could only use pallets for the things you are colour cycling.

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets.

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize across all the pallets) or give each image it's own pallet. That would give you more flexibility

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets.

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize the pallet across all the images) or give each image it's own pallet. That would give you more flexibility but use more memory. Of course you could do both, also you could only use pallets for the things you are colour cycling.

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

added 323 characters in body
Source Link

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets. 

You will also want to work out if you are going to use a 'global' pallet (like. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize across all the pallets) or give each image it's own pallet. That would give you more flexibility

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets. You will also want to work out if you are going to use a 'global' pallet (like how old hardware would work) or give each image it's own pallet.

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

This will depend on exactly what effects you want to produce and if you are dealing with static 2D content or dynamic 3D stuff (ie do you just want to deal with spites/textures, or render a whole 3D scene then pallet swap that). Also if you are limiting yourself to a number of colours or using full colour.

A more complete approach would be to actually produce colour indexed images. Make a texture but instead of having colours, have a colour the represents an index to lookup then have another texture of colours that is the plate. For example red could be the textures t coordinate, and green could be the s coordinate. Use a shader to do the lookup. And Animate/Modify the colours of that pallet texture. This would be quite close to the retro effect but would only work for static 2D content such as sprites or textures. If you doing genuine retro graphics then you might be able to produce actual indexed colour sprites and write something to import them and the pallets. 

You will also want to work out if you are going to use a 'global' pallet. Like how old hardware would work, less memory for pallets as you only need one but harder to produce your artwork for as you have to synchronize across all the pallets) or give each image it's own pallet. That would give you more flexibility

If you just want a cheap fake effect, such as flowing water, you could create a 2nd texture that contain a greyscale mask the area you want to be modified, then use the masted textures modify the hue/saturation/brightness by the amount in the greyscale mask texture. You could be even lazier and just change the hue/brightness/saturation of anything in a colour range.

If you did need it in full 3D you could try generating the indexed image on the fly but it would be slow as you would have to look up the pallet, you would also likely be limited in the range of colours.

Otherwise you could just fake it in the shader, if color == swapping color, swap it. That would be slow and would only work with a limited number of swapping colors but shouldn't stress any of today hardware, particularly if you just dealing with 2D graphics and you can always mark which sprites have colour swapping and use a different shader.

Otherwise really fake them, make a bunch of animated textures for each state.

Here is a great demo of pallet cycling done in HTML5.

added 323 characters in body
Source Link
Loading
Source Link
Loading