Using materials in a level editor

Started by
0 comments, last by zedz 17 years, 1 month ago
I'm working on a 2D level editor that functions by drawing out terrain similar to the polygon select tool in Photoshop. I want to be able to map materials to it in a similar fashion to UnrealEd, and I'm not sure exactly how to approach this. For each material layer, do I have to just render the polygon on top of itself with the appropriate blending, or is there an easier way? I'm using C++, SDL, and OpenGL in an ortho projection for graphics. Thanks!
Advertisement
u will need to normalize the textures first thus the total amount of each equals 1
eg grass 0.3 + rock 0.4 + sand 0.3 = 1.0
thus u blend those 3 textures together in the ratios specified
in a fragment shader its

gl_fragColor.xyz = texA * amountA + texB * amountB + texC * amountC;

This topic is closed to new replies.

Advertisement