I’ve been working on a project that will be for both the web and iPhone/iPad. In the last couple of days I’ve upgraded the project to Unity 3 to save on the hassle of jumping back and forth between 2.6 and 1.7. I’m now seeing bizarre shader/performance behavior when I emulate different graphics chips.
Attached are three screenshots. The first one is simulating version 2.0, which I’ve read on this forum has performance issues. While it looks correct, it is MUCH slower on my iPad and isn’t satisfactory for gameplay.
The second one is simulating any version of OpenGL 1.1. All of the blue bricks in the model are using exactly the same material - a Diffuse shader with no texture - so on top of being wrong it is also inconsistent.
The third one uses no emulation and looks exactly how it should on the iPhone (smoother, actually).
The scene is lit by a single directional light - nothing weird or unusual. I have moved the light around, adjusted its attenuation, etc - no luck other than making the entire thing lighter or darker. I tried using self-illuminating shaders which would eliminate the need of a light at all, but all of the definition on the bricks was lost. I’ve got close to 100 models I need to use that are all exhibiting some color weirdness in this fashion.
Is this a known issue in the beta of Unity 3? Do I need to be using a different type of shader and if so what?
if you use general desktop graphics emulation it won’t have to do much with the iphone as the iphone hardware is pretty specific and not just another “opengl spinoff platform”
Yes, in my Build Settings I have switched the platform to iOS.
Here are the options present in graphic emulation (and they reflect what I see on the device as well once I’ve deployed a build). Only “No Emulation” and “iPhone 3Gs, iPad OpenGL ES2.0” look correct. The other 3 all generate the bizarre color aberrations.
I don’t know what’s going on; it’s as if all of your lights were turned up to max brightness.
You should report a bug, but the shader you chose is completely wrong for the application. Use a shader that uses lighting and vertex colors so the whole thing can be rendered in a single draw call.
Thanks Jessy - I tried the Vertex Lit shader as well, and the bricks that are the wrong color blew out to white, which would seem to confirm your suspicion. Is there a specific shader you would recommend using? I have seen numerous ones on the forums and even tried a couple but they either didn’t fix the problem or resulted in completely the wrong look. I want to use whatever will be the most highly optimized - my models aren’t complicated and I need no fancy lighting. I just want them to look clean and reflect the accurate colors while giving enough definition so that it doesn’t look flat.
You’re going to need to actually make vertex colors, of course, but you’ll only need one material - it can be used on every block. You will, however, need a separate mesh for each color.
Hmmm. This is a bit over my head - sorry. When I apply this my material becomes gray. How do I set the color for the different blocks? I really wanted to be able to take these models as is with the materials they were imported with. Having to do it in code will hose my workflow. This bird in particular only has 3 different materials, so it seems like it shouldn’t be horribly inefficient for the processor.
You don’t know what vertex colors are. You should learn. Changing them in code would be slow and boring; I didn’t suggest it. Do it in a modeling app. Until you learn how to do that, here’s an alternative solution.
(I get the same result with each form of graphics emulation. If you don’t, then it’s a bug with your hardware. If you do, then it probably means there’s some bug in the surface shader system.)
There are many things I should learn. I’m not a modeler, nor do I have a graphics background, so all futzing with shaders and the like is new to me. In my mind, it’s kind of odd to me that Unity (which is supposed to simplify this workflow) doesn’t seem to offer such lean shaders for the purposes of iPhone dev.
There can be no workflow if you don’t have the know-how to put something together. iOS is not a place to to just throw lighting and shaders around willy-nilly. Unity came out when your average user’s hardware was expected to be much better than what’s found in any of the iOS devices that have existed so far.
It would be ridiculous and futile for UT to attempt to make shaders for every single application. They make shaders that are versatile, but the versatility comes at the expense of performance and complication, when you don’t need everything being offered in the shader. Fortunately, ShaderLab is really easy, so you can write your own iPhone shaders from scratch in a few seconds, as I just demonstrated twice. I don’t think these would do you any good if you don’t know anything about 3D graphics (but neither would Unity), but I did make an effort to help people learn ShaderLab, as the manual wasn’t enough for many (and it’s not particularly well-organized if you’re trying to read through it with no background.)
(And for the record, my background is in music and sound design. )
I appreciate the link but not the condescension. When reading your replies I can almost hear the exasperated sigh prefacing it. I came on here looking for help because I obviously don’t know the complications of deploying apps like these to a constricted device like the iPhone. I’ve read the iPhone guidelines and many of the forum posts in the FAQ section. I said I don’t have a graphics background (meaning I’m not a 3D artist), but I’m not some idiot kid who just downloaded Unity an hour ago. I’m ready and willing to learn when someone points me in the right direction, and I will go through your video series as it looks like it will clear a lot up for me.
The statement makes no sense because I didn’t give it. I don’t feel you’re inferior; I just think you are wrong to criticize UT for the reason I described in the previous post. I also find your attachment to your “workflow” irritating, as it should be improved.
That’s a shame. A better description of me would probably be a hyperactive coach screaming at the top of his lungs from the sidelines for you to play better. 8)
I’m of the belief that it’s not worth trying to work in Unity without having studied up on 3D content creation; a person who knows something about 3D is going to get a lot more done in an hour with Unity than others might get done in their lifetimes. I have no idea what tools you’re using. I have no idea what you already know. If you ask about how to learn something, you’ll probably find an answer around here. Personally, I use Blender, and this page is the best source of information for vertex coloring in Blender. But I think it would be hard to jump into Blender just going on that page.
And if you ever find me acting lazy, then I give you full permission to get pissed off at me and tell me so. I find it motivating.