Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 05 Jun 2007
Offline Last Active Yesterday, 03:47 PM

Posts I've Made

In Topic: PBR (blurry reflections)

13 September 2014 - 08:33 AM


I thought it was only relevant on old nvidia FX series, so it makes a difference on mobile devices too.

In Topic: Light - Dot function

12 September 2014 - 04:15 PM

As kauna said you need to normalize light vector and normal of the surface to get reasonable result from dot product (-1, 1) and then use saturate to get value (0, 1) so you can scale your diffuse color (0 - 100%) based on light/normal orientation, on top of that ambient color should be uniform from all directions so you might want to add it instead multiply, something like:

float3 diffuseMap = txDiffuse.Sample(...);
float3 LightDir = normalize(PosD);
float3 Normal = normalize(In.Normal);
float3 LighD = float3 (0.5f, 0.5f, 0.5f);
float3 LighA = float3 (0.2f, 0.2f, 0.2f);
float NdotL = saturate(dot(Normal, LightDir));
FinalColor.rgb = (NdotL * diffuseMap * LighD) + LighA;

In Topic: PBR (blurry reflections)

12 September 2014 - 01:42 PM

Sorry to interrupt into your thread.

I have one question, what is your reasoning for using half instead of float?

In Topic: Efficient way to read .obj files in Visual Studio 2013

22 August 2014 - 06:46 AM

^ +1


Usually obj, 3ds, fbx... are used as "interchange" formats so you can easily transfer/edit across multiple programs since they are well known/supported for import/export, but for your project/game you want to use your own binary format structured in a way that holds only data relevant for your needs, you can even merge multiple models/textures/whatever files in one file to reduce disk I/O count and make it even faster on load.

In Topic: Cannot render the navigation mesh

16 August 2014 - 04:43 PM

I created simple class for you that wrap whole thing in one place




and then you can write simple shader to draw with:


float4x4 WorldViewProjection;
struct VERTEX
    float3 Position : POSITION;
    float3 Color    : COLOR;

struct V2P
    float4 Position : POSITION;
    float3 Color    : COLOR;
struct P2A
    float4 Color : COLOR;

void vs(in VERTEX IN, out V2P OUT)
    OUT.Position = mul(float4(IN.Position.xyz, 1.0f), WorldViewProjection);
    OUT.Color = IN.Color;

void ps(in V2P IN, out P2A OUT)
    OUT.Color = float4(IN.Color, 1.0f);
technique Tech
    pass p0
        VertexShader = compile vs_3_0 vs();
        PixelShader = compile ps_3_0 ps();