Jump to content

  • Log In with Google      Sign In   
  • Create Account


Member Since 24 Apr 2012
Online Last Active Today, 03:22 AM

#5272346 Use different shaders

Posted by Medo3337 on 23 January 2016 - 06:16 AM

You can create a shader management class and then use a function inside the shader management class to load any shader you want and have a pointer stored for each loaded shader so you don't have to load it again.


The function will return that pointer if the shader was loaded before or load the shader if the shader was not loaded yet.

#5269287 Downsampling Problem

Posted by Medo3337 on 04 January 2016 - 05:29 PM



I was setting the view port in initialization instead of rendering.

#5204283 Rendering .obj Model in DirectX 11

Posted by Medo3337 on 14 January 2015 - 02:08 PM

@braindigitalis: What If I don't know where the problem is?


The only thing I see is that dev->CreateBuffer() is returning false when creating vertex or index buffer even both buffers was created successfully.


However, I'm not sure if the box is drawn or not (I see nothing on the screening)

int indexCount = vertexCount;
// Create vertex buffer
ZeroMemory(&bd, sizeof(D3D11_BUFFER_DESC));
bd.Usage = D3D11_USAGE_DYNAMIC;
bd.BindFlags = D3D11_BIND_VERTEX_BUFFER;
bd.ByteWidth = vertexCount * sizeof(VertexType);
bd.CPUAccessFlags = D3D11_CPU_ACCESS_WRITE;
bool r = dev->CreateBuffer(&bd, NULL, &pVertexBuffer);

devcon->Map(pVertexBuffer, NULL, D3D11_MAP_WRITE_DISCARD, 0, &ms);
memcpy(ms.pData, &vertices, sizeof(vertices));
devcon->Unmap(pVertexBuffer, NULL);

// Create index buffer
D3D11_BUFFER_DESC indexBufferDESC;
//ZeroMemory(&indexBufferDESC, sizeof(indexBufferDESC));
indexBufferDESC.Usage = D3D11_USAGE_DEFAULT;
indexBufferDESC.ByteWidth = sizeof(unsigned long) * indexCount;
indexBufferDESC.BindFlags = D3D11_BIND_INDEX_BUFFER;
indexBufferDESC.CPUAccessFlags = 0;
indexBufferDESC.MiscFlags = 0;
indexBufferDESC.StructureByteStride = 0;

indexData.pSysMem = indices;
indexData.SysMemPitch = 0;
indexData.SysMemSlicePitch = 0;

// Create the index buffer
result = dev->CreateBuffer(&indexBufferDESC, &indexData, &pIndexBuffer);

#5204276 Rendering .obj Model in DirectX 11

Posted by Medo3337 on 14 January 2015 - 01:32 PM

@Aardvajk: The problem is: I don't see the model on the screen even I'm loading the vertices and setting up the vertex and index buffer


So, the best thing here is to post the code that I'm using.


FYI: This is just a simple project and it won't take 5 minutes to look it up.


Do you think someone is going to download your project, set it up on their system, investigate and fix the issue then send back the fixed project, all from the goodness of their hearts?



Yes, I'm expecting people here will help.

#5204263 Rendering .obj Model in DirectX 11

Posted by Medo3337 on 14 January 2015 - 12:44 PM

@fastcall22: What do you mean?

#5204249 Rendering .obj Model in DirectX 11

Posted by Medo3337 on 14 January 2015 - 11:50 AM



I'm trying to render a box model (.obj file) but I don't see anything, I have attached the project file.

Attached Files

#5160387 Most Efficient Way for Lighting in Forward Rendering

Posted by Medo3337 on 13 June 2014 - 05:49 PM

I'm currently using Forward Lighting and trying to do my best to make sure that the FPS game will always render all the lights


1. In Pixel Shader 2.0, I have

DirectionalLight dirLights[maxLights];
PointLight pointLights[maxLights];
SpotLight spotLights[maxLights];

What is the appropriate number for the variable maxLights?


2. Since Forward Lighting is limited to a certain amount of lights, I have been thinking that I could:

- Detect collision between the light and the camera bounding frustum and only render the light if the camera can see it

- Arrange the lights from closest to farthest to the camera and remove any light if it's index is over 'maxLights' variable


What do you think about my idea? What is the most efficient way to work with forward lighting?

#5110486 Shadows Problem

Posted by Medo3337 on 19 November 2013 - 09:43 AM

@belfegor: Since I'm bored, I wrote the code like that


But anyway that's not the point, the point is that shadows doesn't work correctly

#5107606 Computing view matrix to create shadow map

Posted by Medo3337 on 07 November 2013 - 12:05 AM

I'm trying to generate shadow map so I can pass it to the shader and create shadow


I have bunches of lights (including directional lights, point lights and spot lights)


How do I calculate the view matrix to create the shadow map?

#5097736 Rendering only what the camera see

Posted by Medo3337 on 29 September 2013 - 11:33 PM

For getting higher performance, is there is anyway to render ONLY what the camera see?
Since it's not really important to render anything that the camera can't see

#5092469 Skybox VS Skysphere

Posted by Medo3337 on 08 September 2013 - 07:22 AM

What is most used commonly in modern FPS games?


Can I use cube map on skysphere?


Some sky textures looks very good on the texture but when I try to apply it to the sky sphere it doesn't look as good as it was, that's why I'm thinking that I could use cube map.

#5092375 Skybox VS Skysphere

Posted by Medo3337 on 07 September 2013 - 07:31 PM

Hi guys,


What's your recommendations? Should I use sky box or sky sphere?


If I used sky sphere, should I apply cube texture to the sphere or just a single texture?


What is more commonly used especially in FPS games? Which one can produce better sky and which is easier for producing different looking skies?

#5091826 Particles Depth Problem

Posted by Medo3337 on 05 September 2013 - 11:30 AM

Thanks MJP


One last depth problem:

When I disable soft particles, the particles appears in front of the camera ALL THE TIME even if they are very far away and I have many buildings much closer, I can still see the particles (while I shouldn't).

#5090082 Blending Two Animations

Posted by Medo3337 on 29 August 2013 - 05:40 AM

@Tispe: Let me explain to you better:


Available Animation presets:

- Walk

- Run

- Reload


Here is example:

delay(5000); // Delay for 5 seconds

What do I expect from the above code?

The character starting walking and after 5 seconds he will reload his weapon WHILE still walking.


What happens instead?

The character start walking, but when he reload, the "walking" animation RESET


What should happen?

When the character reload his weapon, the animation transition should only affect his arms and not his legs, the walking sequence should not get affected


I can only resolve this problem when I don't have animation smooth transition by only changing the intended animation track while leaving the other as it is, but how do I fix it while I have smooth transition?

#5089805 Blending Two Animations

Posted by Medo3337 on 28 August 2013 - 06:49 AM

Lets say I have 4 different animation presets inside "character.x":

- Idle

- Walking

- Running

- Reloading weapon


I can play any of them, switch between idle to walking smoothly, but


How do I play both animations "running and reloading weapon" at the same time?


I have been looking for any code sample to accomplish that using D3D9 but I didn't find any.


I'm using D3D9 Animation Controller ID3DXAnimationController.