Gildor's Forums

Author Topic: Rendering Bioshock Infinite models  (Read 4742 times)
Ehamloptiran
Jr. Member
**
Posts: 51


View Profile
Rendering Bioshock Infinite models
« on: May 08, 2013, 23:14 »

Hi all,

Hoping to get some help from anyone, especially Gildor if you have a spare moment. I am implementing normal mapping for rendering Bioshock Infinite models (StaticMesh at this time). So far I think I have figured out it stores 4 bytes for Tangent and 4 bytes for Normal, but I cannot seem to figure out the calculation for the Bitangent (Binormal) that looks correct. (It will look fine for most meshes, but then anything with mirrored normals gets screwed up). I was hoping Gildor you might want to advise me on how you calculate the required parameters (or where to find them, etc.) I am feeling pretty silly at the moment, since I cannot seem to get it right :S

Anyone else who may have accomplished this in other games can also jump in and advise.

Thanks in advance
-Ehamloptiran
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7977



View Profile WWW
Re: Rendering Bioshock Infinite models
« Reply #1 on: May 09, 2013, 12:23 »

Check the "Unreal coding" board, I believe something relative to mesh normals was discussed here. Also check "ME3 Explorer" project, I think it has solved this task already. Bioshock Infinite and Mass Effect uses the same engine basis.
Logged
warrantyvoider
Full Member
***
Posts: 109


View Profile
Re: Rendering Bioshock Infinite models
« Reply #2 on: May 09, 2013, 13:42 »

I guess you can use this, it assumes packed tangent quaternions as you described, but you can twist a thing here and there, and by this get a combination of at least 2048 different configurations... I am myself on the hunt for the correct formula. Then there are also optimization possible: for mirrowed meshes you have to fix UV coords where the two parts meet, because a triangle there may face towards you, but the triangle in texturespace is faced away from you. There you have to shift the U value up by 1 to get better tangent calculation. Then epic uses another optimization on top of that, which I havent understood yet, so any input is VERY welcome Cheesy

my import code and tangent calculation

greetz WV
Logged
Ehamloptiran
Jr. Member
**
Posts: 51


View Profile
Re: Rendering Bioshock Infinite models
« Reply #3 on: May 11, 2013, 17:15 »

Okay so I have dumped some of the shaders used. And it appears they only use the Tangent and Normal, and then calculate the bitangent (Binormal) in the shader. I also see references to NormalsType (float), NormalsSphereCenter (float4) and NormalsCylinderUnitDirection (float4). Not sure how they calculate it yet as I am not great at reading shader assembly.

The shader file is too big to paste in here, so I have uploaded it to my google docs share. Someone with some more experience in reading shader assembly might want to shed some light on it.

https://drive.google.com/folderview?id=0BzqpBc4MrAMXYzQyY1VYQVBMR2c&usp=sharing
Logged
Gildor
Administrator
Hero Member
*****
Posts: 7977



View Profile WWW
Re: Rendering Bioshock Infinite models
« Reply #4 on: May 12, 2013, 03:11 »

Binormal is calculated as cross product of normal and tangent, plus getting sign from 4th component of normal.
Logged
Jump to:  

Powered by SMF | SMF © 2006-2009, Simple Machines LLC
Leviathan design by Bloc | XHTML | CSS