- Home /
rgb value detail
I have a silly question , how can i force a camera to olny display color to a certan detail. for example if i wanted to make a game that olny render n^3 colors this would require that rgb values be rounded to the nearest multipul of n.
My apoligys for incorect spelling.
thanks in advance
Sorry but you have to ask your question in a way it's clear and understandable. That has nothing to do with bad spelling but simply bad explanation. "n^3" usually refers to "n to the power of three" or to the bitwise xor operator. I don't see how any of those two meaning would make sense here. What is "n"? If n should be the "number of shades" what does n^3 mean?
Please spend a little bit more time on explaining the question. You expect us to spend time to figure out what you actually want and to write an answer for you ... Feel free to edit your question.
I'd say, use a replacement shader or image effect for the camera that that does what you need.
@Bunny83 i feel im being clear.I want my game to round to the nearest of n^3(being n*n*n) colors, or example 64.If we olny want 64 colors the rgb values displayed by the screen would have to multaple of n ,n being the cube root of the number of colors you want to be able to render, i we want to have 64 colors n will be 4.
Wat? Why would you want to programmatically force a camera to render less colors than it can?
@$$anonymous$$acDx for stylistic reasons, you could use it to make you game look like it was made in the 16 bit era
Ah I see
You don't override the camera's rendering capabilities to achieve that. Ins$$anonymous$$d, you use images for your sprites and textures that only contain 16 bit colors, use 16 bit format compression. Use pixel art with low resolution images, etc. Style mainly comes from shaders (making your own or using the ones unity provides), lighting and texturing .
With that being said if you still insist on doing it that way, what you could do create a script that has the OnRenderImage(RenderTexture src, RenderTexture dest) method and attach that to your camera. Then inside that method call Graphics.Blit(src,dest,mat); where mat is a material field that has a custom image effect shader. Such a shader will take each pixel in the image that the camera already rendered and then change it to whatever you want. The default image effect shader Unity gives you when you create a new one is a shader that inverts every color.
You would be implementing a post-processing effect.
Your answer
Follow this Question
Related Questions
Efficient Way to Get Pure RGB Data toCSV 0 Answers
Convert RGB to RYB color scheme? 0 Answers
prefab rendering on top of its parent? 0 Answers