Jump to content

  • Log In with Google      Sign In   
  • Create Account

We need your feedback on a survey! Each completed response supports our community and gives you a chance to win a $25 Amazon gift card!


Noxil

Member Since 27 Sep 2010
Offline Last Active Private

Topics I've Started

Setting up VS2012 with Directx11 (multiple projects)

14 December 2013 - 07:10 AM

Hello.

 

So this is something that is asked alot 

All the tutorials and all the responses say the same.

 
1: Add include path to "Configurations -> VC++ Directores -> Include Directories"
2: Add lib include path to "Configurations -> VC++ Directores -> Library Directories"
3: Add what libs you are intressted in to "Configurations -> Linker -> Input -> Additional Dependencies"
 
It works just great when i only have 1 project in my solution.
But i just cant get it to work for a solution that holds multiple projects.
 
This is what i have tried:
1: Do the steps for the project that holds my directx 11 code (only 2 files at the moment)
2: Do the steps for each project in my solution (4 projects)
3: Do the steps for the startup project of the solution
 
The result i keep getting is either "cannot open include file: d3dx11.h" or "unresolved reference CreateDXGIFactory" 
 
I am using the June 2010 SDK if that can help.
 
Im clearly missing something. I just dont know what.
 

Opinions on a tool im making

10 August 2013 - 03:32 AM

Hello what i want to achieve with this thread is to get some feedback from you guys from your experience with

how it is to set up a new game project for your or a pre existing engine.

And it would be great to get some feedback on my current setup.

 

So.. The tool im making is meant to be used like this, you want to start a new game project with the game engine.

Use the tool, type in the name of the new game project and the tool will generate the folder structure on the correct places

and it will also generate vcxproj, vcxproj.filter, vcxproj.user, sln and bat files for pre and post build events.

 

The idea came about after one of my pre build tools was completed and i realized if i ever was going to create a new game project

id have to go through and make sure that all pre and post build events are setup correctly. Not to mention the normal procedures 

of setting up the sln with all engine projects and project dependencies etc etc...

 

What i hope to gain from this is to be able to easily setup new projects and just get started and know that everything will just work.

I dont want to have to spend 30 minutes on making sure everything is setup correctly.

 

Im sure the topic "folder structure" is one that can go on for ever, but id like to share my first draft of a folder structure for how things will look
when the tool is used,

 

root (root folder of all code and content)

- Engine (containing all engine projects and engine resources)

- GameX (named based on input in the tool)

- GameX - Build

- GameX - Build - Debug

- GameX - Build - Release

- GameX - BuildConfig (pre, post build bat files)

- GameX - Resources (all the resources the game uses)

- GameX - Src (code for GameX)

- GameX - Work (raw work files, like .psd .fbx etc etc)

- GameX - GameX.sln
- GameX - GameX.vcxproj
- GameX - GameX.vcxproj.filters
- GameX - GameX.vcxproj.user
 
So when you wanna work on GameX then you simple open GameX folder and open its .sln file.
It should then be setup correctly to use the projects from Engine.
And whenever you compile in debug or release the builds will end up in the Build folder.
 
So any feedback, thoughts, ideas or questions is more then welcome smile.png

 

 


Crashes while writing to file

01 August 2013 - 04:51 AM

Hello

 

The problem im having is that the program crashes while writing to a file.

I have made a tool that generates code during the pre build step.

 

The code doing the writing looks like this:

#define WRITE_LINE( x ) file << x << "\n";

std::ofstream file( "GenClass.cpp" );
...
WRITE_LINE( "some text" << someVariable << "some more text" )
WRITE_LINE( "long line of text" )

The code is very simple.
And at the current state it dosnt write that much either.
It writes about 1000 lines of code.

 

It crashes when it tries to write regular text just like the second example of WRITE_LINE.

If for example the text im trying to write at the point of the crash is "void TestFunction()".

It only writes "void Tes".

If i change the text to "//void TestFunction()".

It only writes "//void T".

 

So it feels like it maxes out some sort of buffer.

Never run into this before, so not quite sure what to do.


Deferred rendering issue

30 March 2013 - 02:33 AM

Hello

 

I have an issue in my deferred renderer (Dx9).
As seen in the attached image between my meshes there is a small black line.
This line becomes visible depending on the distance between the camera and the meshes.

 

The problem seems to be in the point light shader.
Since if i remove the light output and just draw color on the screenquad everything looks fine.

 

GBuffer:

VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
 
    float4 worldPos  = mul( float4(input.Position.xyz, 1.0f), World );
    output.Position  = mul( worldPos, ViewProjection );
    output.UV  = input.UV;
    output.Normal = mul( input.Normal, World );
    output.Depth.x  = output.Position.z;
    output.Depth.y  = output.Position.w;
 
    return output;
}
 
PixelShaderOutput PixelShaderFunction(VertexShaderOutput input) : COLOR0
{ 
    PixelShaderOutput output;
 
    output.Color = tex2D( DiffuseMapSampler, input.UV );
 
    output.Normal.xyz = ( input.Normal + 1.0f ) * 0.5f;    
    output.Normal.a = 1.0f;
 
    float D = input.Depth.x / input.Depth.y;
    output.Depth = float4( D, D, D, 1.0f );
 
    output.Glow = tex2D( GlowMapSampler, input.UV );
 
    return output;
}

 

Point Light:

 
VertexShaderOutput VertexShaderFunction(VertexShaderInput input)
{
    VertexShaderOutput output;
 
    float4 worldPos  = mul( float4(input.Position.xyz, 1.0f), World );
    output.Position  = mul( worldPos, ViewProjection );
    output.ScreenPosition  = output.Position;
 
    return output;
}
 
float4 PixelShaderFunction(VertexShaderOutput input) : COLOR0
{ 
    //obtain screen position
    input.ScreenPosition.xy /= input.ScreenPosition.w;
 
    //obtain textureCoordinates corresponding to the current pixel
    //the screen coordinates are in [-1,1]*[1,-1]
    //the texture coordinates need to be in [0,1]*[0,1]
    float2 uv = 0.5f * ( float2(input.ScreenPosition.x,-input.ScreenPosition.y) + 1.0f );
 
    //allign texels to pixels
    uv += HalfPixel;
 
    //get normal data from the normalMap
    float4 normalData = tex2D( NormalMapSampler, uv );
 
    //tranform normal back into [-1,1] range
    float3 normal = normalize( 2.0f * normalData.xyz - 1.0f );
 
    //read depth
    float depth = tex2D( DepthMapSampler, uv ).r;
 
    //compute screen-space position
    float4 position;
    position.xy = input.ScreenPosition.xy;
    position.z = depth;
    position.w = 1.0f;
 
    //transform to world space
    position = mul( position, InversedViewProjection );
    position /= position.w;
 
    //surface-to-light vector
    float3 lightVector = LightLocation - position;
 
    //compute attenuation based on distance - linear attenuation
    float attenuation = saturate( 1.0f - (length(lightVector) / LightRadius) );
 
    //normalize light vector
    lightVector = normalize( lightVector ); 
 
    //compute diffuse light
    float NdL = saturate( dot(normal, lightVector) );
    float3 diffuseLight = NdL * Color.rgb * Intensity;
 
    return float4( diffuseLight, 1.0f ) * attenuation;
}

 

Any help is much appreciated! smile.png


LostDevice problem

03 October 2010 - 10:40 AM


Hello,

I have read some of the other posts on this forum regarding this but I dident find anyone that could help me.

So here it goes.

When I toggle from fullscreen to windowed mode, it works perfect.
Untill I use a shader...

If I have loaded a shader, it enters fullscreen and the instantly switches back to windowed.

This problem disappears if I dont load the shader.

This is how I load my shader:

D3DXCreateEffectFromFile(direct3d->device, path.c_str(), 0, 0, 0, 0, &shader, &compilationError);



And I simply use the OnLostDevice and OnResetDevice functions when I detect a lost device.

PARTNERS