Any way around a beta 7 graphics problem?

I’ve reported a bug with 3.0 beta 7 on iPhone, but would like to keep using it if possible, so I’m hopeful someone may realise where the problems come from and suggest a way to work around them. It may be 2 separate problems, but maybe not, so I submitted them as 1 bug.

I’ve been using the Texture Only shader from the Unity Community Wiki. In beta 7, when objects batch, the batched items UVs get messed up, looking like they are trying to show the entire atlas texture in each patch. Going to the Diffuse Fast shader solves the problem, but I don’t want to lose the performance the TO shader gives, and anyway, I get left with the problem below.

I have 3 atlas textures so that I can reuse models up to 3 times. If I go to the other shader for the materials, the batching problem stops, but I get a single colour rather than a texture on some models when used with one of the textures, but the same model is fine with the other 2. Only a couple of the models using that texture have a problem (all 3 textures were created at the same time from the same Illustrator file).

I’ve tried re-importing the models and texture, but no luck. Any suggestions for something I could try to keep me going without resorting to reverting to beta 6?

Hah, i’ve got this problem as well (also filed a bug for it) I believe it is related to object batching and lights in scene. The problem seems to be only for shaders that have lighting off, so a hack would be turning lighting on in shader (occurs overhead if you have many lights but guess it’s a start until bugs are fixed).

Thanks jkreijkamp, I have no lights in my game, hence using shaders that don’t use lighting.

My problem is I am days away from completing my game, so it might be submitted before the next beta. I think I’ll have to roll back to beta 6.

Although I sounds silly, but try just to add a Lighting On to your shader pass, so you get something like:

Shader "Revolt/NoLights" {
    
	Properties 
	{
        _MainTex ("Base (RGB) Self-Illumination (A)", 2D) = "white" {}
        _Color ("Main Color", Color) = (0,0,0,1)
	}

	SubShader {
		Tags { "RenderType" = "Opaque" }
		Tags { "Queue" = "Geometry" } 
		Pass {
			Lighting On
            SetTexture [_MainTex] {
				ConstantColor [_Color]
                combine texture + constant
            }
		}
	}
}

Even when you don’t have lights in scene, it could actually help I think.

I noticed the same thing - batching is broken in beta 7. In most cases my scene renders either flickering random objects or nothing at all for those objects that usually batch dynamically. I don’t have any lights in the scenes, and lighting is turned off in the shaders.

Also, they seem to have changed something in batching in general, in 1.7 my skinned mesh objects (very simple ones, with only a few bones each) seemed to batch nicely.

Now they don’t do that anymore, increasing the draw call count quite dramatically. Time to file another bug :wink:

br,
Sami

I confirm - dynamic batching is breaking the UV’s on two seperate applications.

It would solve the main batching problem, but I would lose the performance given by not using it.

I have a choice of hacking my game to suit, or not using the latest beta. At this stage of development, it is an easy choice, revert to beta 6.

The easiest workaround would be to set Normals to None instead of Calculate/Import in FBX Importer inspector

Thank you Alexey, that works brilliantly for me.

Actually, I spoke too soon. It has stopped the batching problem, but I still have trouble with some of my models appearing blank on the device, but not in Unity.

Yes, this can be 8). It was just the usual cause of bugs was with normals present but not needed for shaders. You can rest assured that in next drop it will be fixed.

Are you planning to drop batching support for skinned meshes for good? At least my meshes no longer batch if they have any bones in them :frowning:

br,
Sami

its no plan, it was done already.
U3 does not batch skinned meshes and according to official mentions, thats intend behavior.

But it shouldn’t be all that much of a problem. if you benchmark it you will realize that the performance still outperforms Unity iphone 1.7

It now keeps saying the ‘Shader wants normals, but the (primitive) doesn’t have them’, so your statement makes sense.

I’ve done a lot of digging into the objects that are appearing blank in my game.

I have 10 models in the game. 1 is used for the menus, leaving 9 that reuse 3 texture pages. 6 appear on all 3 pages. The player craft appears on 1 texture, and 2 models share that space on the other 2 textures. There are 2 models that are showing up plain green when used with the player craft page (the main colour of that page and the models), but appear OK when used with the other 2 texture pages.

I exported the texture from Illustrator again with no change. I changed the UV mapping of the 2 models and reimported them. Now all 3 versions of each model are appearing plain, but in a colour relating to their texture page.

They appear correctly if I change from a texture-only shader to Diffuse Fast. Is the fix in the next version likely to solve this problem also? Is there anything I can do now without using the slower shader? My game will hopefully be finished in the next couple of days, so I may be ready for release before the next beta.

I’ve encountered this in the current beta as well using both the Unifywiki’s texture-only shader and my own flavor.

other than that:
Unity3 BETA 7; its up to you if you want to publish with a piece of software that is still in beta :slight_smile: Totally your choice.

Yes, all these issues will be fixed in next beta/rc. I can go technical into why did this happened, sure, but who needs this ;-).

I’ve fixed the blank appearances by building new models from scratch. There were only 2 that needed fixing, and there might have been some underlying problem that I am better off without.