Normal mapping

Blitz3D Forums/Blitz3D Programming/Normal mapping

Pseudo-tutorial-in-a-codebox

;; STEP 1 :: Load normal map
NM = LoadTexture("normalmap.png")

;; STEP 2 :: Make it combine with the previous texture through a dot product
TextureBlend NM,4

;; STEP 3 :: Apply it to an entity
EntityTexture Entity,NM,0,0

;; STEP 4 :: Inside the main loop, update the entity's lighting either through vertex coloring or the EntityColor instruction.  EntityColor is faster but will be inaccurate, while VertexColor is slower but going to provide a lot more accuracy in the normal map.  Here I'll use EntityColor
EntityColor Entity, 127 -0, 127 +64, 127 +127  ;; The light is in front of and above the entity in this case (at least if I'm not mistaken, I'm a bit clueless right now so bear with me)


Only did this once on my own, so whatever.