3D Object doesnt show

Started by
6 comments, last by xlrrr 7 years, 7 months ago

Hello to all,

First of all I am a new member in this community, been a reader until now, but I actually need some help.
I am a complete newbie in DirectX programming and I am trying to visualize a basic icosahedron on my screen. Despite doing all the steps in the tutorials I have watched/read, it just doesn't show.

The vertices of the figure are properly filled as well as the triangles. I changed the shader to return hard coded color, since i thought that because my vertex dont contain data about the color that may be a problem. I am willing to learn and if someone can see the mistakes I have done and inform me, i'll be really greatful. I have tried to fulfil all the steps needed in order to complete the graphics pipeline, but didn't have luck.

My code is available at https://github.com/xlrrr/SolarSystem

If anything is wrong with the code, please, let me know. Seeing my mistakes will help me learn.

Advertisement

before i look at your code, just some debugging tips

use the visual studio graphics debugger and check to see that your geometry is being set correctly when you call draw on your sphere. You will be able to see the outputs of each pipeline stage that you use, including input assembler, vertex shader, rasterizer, and pixel shader

in the input assembler output, you should see your sphere in wireframe. in the vertex shader output, you should see a wireframe of your sphere of how your camera would view the sphere, and in the pixel shader output you should see your sphere shaded in with whatever colors your pixel shader is outputing.

Once you do that, reply with what you find, like if you see nothing for output in any of the stages

you can start debugging by going to "Debug->Graphics->Start Graphics Debugging" or by pressing the keyboard shortcut "Alt+F5"

Well in the graphics debbuging i dont really see where the outputs of each graphics pipeline stage should be stored, so i guess that should be a'nothing for output in any of the stages'

In your sphere draw method you don't issue a draw command, so nothing will be rendered.
Also try to use render doc for debugging. In my opinion it has a far better interface.

i added in my draw method


	deviceContext->Draw(VerticesList.size(), 0);

I have found another issue, when creating the sphere, i wasn't actually calling createShaders() in the constructor.
Despite not calling this, when launching the program it didn't crash my video driver. As far as i'm aware it should have crashed when there were not properly assigned vertex and pixel shader

Create the device with D3D11_CREATE_DEVICE_DEBUG and watch the debug output window. The D3D11 debug layer will report screw-ups with (usually) great detail.

Hi.

I have been working on a similar project (solar system). I skimmed your code and found this:


const float X = .525731112119133606f;
const float Z = .850650808352039932f;

in the method Sphere::createIcosahedron.

I don't think a float can store this much precision (at most 6 decimal digits; check reply by Stephen here).

This may not be a big issue right now and the project might work now but this may make problems later if it is not taken into consideration.

Cheers...

Yeah, note taken.

I think that the problem may be in the beginFrame in the DXRenderer when im using


m_deviceContext->OMSetRenderTargets(1, &m_renderTargetView, m_depthStencilView);

i'm not really sure that I am using the depthstencilview properly

This topic is closed to new replies.

Advertisement