Why meshes for Pawns? Rendering question

Started by JuliaEllie, December 18, 2014, 06:03:25 AM

Previous topic - Next topic

JuliaEllie

Hey everybody,

Im looking into the possibility to build textures on runtime from several other textures which would be different interchangeable parts of the texture.

First I thought about something like making an empty texture by "Texture2D fu = new Texture2D();" and then adding the content of other Texture2Ds to it similar to a list or table or array. I found nothing about this on the internet so I assume this is not
suitable/possible/feasible/bad style/not practiced for whatever reason.

Then I took a closer look at the PawnRenderer and as far as I understand it it makes several meshes for every part of the Pawn then puts the Materials on them and then renders the Meshes for each part (body,head,hair,etc).

My question is: why does Tynan use those Meshes instead of drawing the Textures directly with Graphics.DrawTexture which can also use Materials? Maybe this question can only be answered by Tynan himself but I didnt want to bug him with my questions before I asked the community :)

Tynan

Graphics.DrawTexture draws to screen coordinates and isn't appropriate for in-world rendering.

Everything in the game is done with the same kind of mesh rendering using shaders with textures.

As for building textures at runtime, it would be useful. I might be tackling this myself soon. You have two options. One is that you can use Unity SetPixels on a Texture2D. The second, and much faster method is to use a camera and render other textures together to a single texture. This is how the world map image is generated and is how I plan to approach the problem (for generating textures for statues, in my case).
Tynan Sylvester - @TynanSylvester - Tynan's Blog

JuliaEllie

Thanks a lot Tynan :) I will look into the camera approach after christmas. Merry christmas to you :)