Made an asset I think I will sell on the asset store.

I had to atlas a bunch of stuff anyway for the performance..AND HOLLY HECK DOES IT PERFROM!

Check these stats out…
This scene first not combined and then combined.

scene.jpg

Stats not combined… 500+ draw calls…

shotA.jpg

With the press of the combine (Which I will have a realtime mode for me also….

shotB.jpg

9 I REPEAT 9 DRAW CALLS AND IN REALITY IT IS 1
The rest are unity items rendering…. Freaking indredible..

The code takes the heiarchy it is on and then takes all the children meshes and their materials. It then atlases the UVS and then the color texture. Then it copies and sizes all the other textures (Specular, Height, Occlusion, Normal, Emissive, etc) into the locations to match the color map which the UVs are tied to. Wow… I need to clean this up and offer it to others so hopefully I can recoup some of the billions I have spent in the asset store lol…

Pretty cool! I would have bought this in a heart beat to save all the time….

Time to optimize!

So far optimized from 11 seconds compress to 0.9 second compress.. Not bad..

Advertisements

Well made it past one hurdle

I spent a few evenings wrestling with a Lightmapping problem that should never have been happening… but a plugin switched a lighting mode flag that broke everything the way I wanted to do it. For those that might encounter this blog lighting was set to linear not Gamma… that broke all lightmaps in RGB… HARD TO FIND….andI still don’t know why … The shaders do not read the format just the colors. Thus feeding an RGB should work. Now linear lightapping must hit a different pipeline in the standard shader.

See these posts to see more:
https://forum.unity.com/threads/normal-map-to-rgba-and-just-set-it-to-the-_bumpmap-not-working.576370/

https://forum.unity.com/threads/i-cannot-find-an-answer-texture2d-packtextures-with-normal-maps.574318/

After a LOT of frustration I tried Unreal for a day. I like a few things. However, the compiling of c++ code would slow me down several hundreds of percent. Along with debugging c# code is FAR easier. Keeping up with c# code through engine upgrades is a TON easier. Not managing a header .h and a implementation file .cpp for every code segment saves a ton of time. The blue print system is not strong enough to not use c++ code all over the place. It also seems you have to use a blueprint to interface to the c++ so another level of complexity. The speed gains of c++ over c# can be managed very well and in some cases c# may even win from my research. Thus the only item perceived as better is graphical power. (Not on mobile devices at all Unity kills there for speed and memory footprint) However, one real reason Unreal always looks better in demos is Epic has the VERY best artists in the world creating them. That is the big difference. Any scene in Unreal can be created in Unity and faster.. at least all the scenes I have scene. I have not seen anything graphically Unity cannot do that Unreal can. Also I must mention Unity supports 3-4 times the devices Unreal does last check. Unreal also has difficulties in dynamically generated worlds, items, etc. Unity does also but you can get around the hurdles with lots of research. It seems Unreal suffers from lightmapping issues that Unity used to as far as loading dynamic levels and storing lightmaps in the .map file as unity did in the lighting assets file (I did not research this fully so take it with a grain of salt. I did find work arounds in unity).

I got a simple scene running with blueprints testing dynamically loading in Unreal.. and made my decision to stick with unity. I am glad I took the time as it has bothered me since Unreal became free that I might be in the wrong engine with all those pretty demos. Also another added issue is the tax Unreal charged for any game over 3000.00 is 5% GROSS…not net.. thats about a 8-10% tax going to Epic. Add in what apple charges last check was 20%. So add them up with the governement and close to 50% of your hard work is gone. Unity’s charges are far better. All in all a good exercies and I am very happy to be sticking with unity…

Where I am now is I have the Characters generating from pieces. Their texture map is correct and atlased using Unity’s texture packer. However, the issue is it packs your colors great. Then you go to pack your normal maps and you have to use the same function again. Thus your UVs do not match up now to the normal map! Argh! I want as few hand coded shaders as usual so as to work across all the engine and plugins expecting the standard shader. Thus I do not want a seperate channel for Normal map UVs. So now I have to take the rectangles given back to me and do my own atlasing to fit the textures… again argh… Should not be to hard without filtering..What I will do is copy the texture by hand into the new normal map texture and scale it by the rectangles size to fit inside the recatangle.

Off to do another thing Unity should really do for you.. what good is a model without a normal map…..

Wow I wrote a book =) More later…..

And it is later…..
And Fixed. I may publish this code on the asset store I know I would buy it.. it does not scale up a normal map but it will scale down the normal map from the packed texture rects unity can do. Why we cannot provide multiple textures of multiple resolutions to pack I do not know. That would be best. And who needs a normal map greater size then a texture color map? Really who =)

Bah … Unreal engine is nice

However… I see about 2-3x the work to do what I want to do. I will just have to work around this issue… =).. Back to unity!..

I did have a lot working in unreal and I did miss the speed of c++ but not the extra coding time.

Back at it…

aaaaaaa.jpg

Got the first part done.. That was not to bad I may sell that tool. Now I have to be sure it scales the texture down if the normal map is a different size from the color texture. weeeeeeeeee…… Finally sucess after a few days of misery.

And that is just test art… so don’t mind the uglyness….

Checking out unreal engine

https://forum.unity.com/threads/i-cannot-find-an-answer-texture2d-packtextures-with-normal-maps.574318/

I actually implented the first real time in game shadow mapper way back when in the unreal engine with Jon Olick. (Major credit to him) And I am running into issues as seen in the link above so today I am going to spend exploring Unreal 4. It is a different animal now so we shall see. In any case it will quell some fears I am in the wrong engine with the lack of acccess to deep calls Unity gives. BUT unreal maybe the same way. It will be nice either way to be sure I am starting again on the right foot.

Plus they support c++!!! Weeeeeee good old days!

Awesome…

Fully combined skinned meshes..And atlased textures… I just pass GameObjects into a script and it combines them. Creates one texture for all the parts and one normal map. I can auto scale resolution for less capable devices!… Time to get some other assets moved over…Three out of 5 of the hardest code sections complete =-).. AND WAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAY better and more robust!

Those are the pieces.
I keep all the humanoid figures in one blender file and export individually. I have one base skeleton and all the parts broken off. I keep the intact model so I can transfer skin weights at anytime…. More later this is getting GOOD!

ScreenCap1_26451.png