The video playback in Unity doesn’t do what I need it to; so, I’m trying to write a plugin to playback a MNG movie. we’ve been using them for years, so we figured we can write a plugin that’ll use them and we can control playback however we want. (/hurray Unity Pro)
Anyway, here’s my problem: The colors are all messed up. I can’t figure out how to pass the colors properly to Unity. After many hours of racking my brain, I figured out I’m required to use floating point values. Since all of my values are in unsigned char, I have to convert them. Right now, this is what I’m doing:
it works enough to be able to see the movie, but the colors are messed up. i trying swizzling the colors around, and it just wouldn’t render properly.
So I began experimenting, to figure out what colors correspond to which index. I sampled the colors inside Unity with the eye dropper, I found out that a value of 1.0 (inside the plugin) equals to 204(RGB)? This doesn’t seem right. Am I doing something wrong?
from my experiments, I found that the format is RGBA not ARGB. But what mostly confuses me is that colors don’t translate properly from the plugin to Unity. how can 1.0 be equal to 204/255? The ambient light is at full white, so that’s not darkening the image.
same as before, except now i’m putting in values myself. Again, I sampled the texture using the eye dropper in the material box. I’ve attached a screen shot of the results.
I only used gimp to save the screenshot. The sampling was done from within Unity. If you click on an object that has a material, you have the options of changing the “Main Color” or setting a “Base (RGB) Trans (A)” for the texture. (I’m using the Transparent/Diffuse Shader). Next to the “Main Color” option is an eye dropper. You can see it in the screenshot. The color selection window is generated by Unity when clicking on the color box after sampling the texture.
Got my plugin to work! After a lot of trial and error, I found out that Unity uses RGBA. Once I made this change it worked beautifully!
So to clarify, my plugin would playback a movie. Internally, it holds the information in ARGB format. From Unity, I pass an array of Colors to the plugin. When accessed from within the plugin, you need to set them as RGBA.
If that’s what XCode defaults to, then yes. I’m pretty much a mac noob. All I did was create a Carbon Bundle, like the documentation said to do. I put the files in the project and built. When I built the Unity player, the colors were all messed up. The project was created and built on an Intel-based Macbook Pro (because it had unity pro installed). I tested it on both a ppc-based and intel-based mac, with the same results. So I swapped the colors around to work properly.
xcode normally targets universal builds, at least it did so in 10.5
with 10.6 its not a topic if you focus on 10.6 as PPC is no longer supported by apple on the new os