Jump to content

  • Log In with Google      Sign In   
  • Create Account

BornToCode

Member Since 17 Apr 2004
Offline Last Active Aug 28 2016 11:18 PM

#5270472 How the 'perspective division' should be done?

Posted by on 10 January 2016 - 07:36 PM

Just to extend what Hodgman said. After you apply your projection matrix. all components are divided by w which clamps your x and y between -1 to 1 and z from 0 to 1 in DirectX and -1 to 1 in GL.




#5270438 Working for a startup.

Posted by on 10 January 2016 - 02:24 PM

I am kind of in a dilemma right now. I have been working in the graphics industry ranging from games to projectors for the past 10 years. I recently received a job offer for a Senior graphics role in a start up company, at the same time i also received another job offer working in the medical field on a 3d cad like software. The medical one uses Javascript and WebGL. The other one as we all know is C++/DirectX11. I also have two kids, so stability/work life balance is very important, but at the same time i know i would enjoy the graphics role more. But in the back of my mind i know that the graphics role which is for the game company probably not gonna last a long time.So what would you guys recommend in that case.




#5249743 [D3D12] Create anything anywhere?

Posted by on 30 August 2015 - 12:22 PM

A Default heap can only read and write on the GPU side. The CPU cannot see that memory. This is the faster because the memory is right then and there on the Graphics card.

A Upload heap the CPU can write to it but not read, and the GPU can read from it but not write to it. This is slow because the GPU will have to marshalled over everytime it needs that data.

A ReadBack heap allows the CPU to read the Data. This is even slower because the CPU needs to request the data from GPU which in terms will write the data to some piece of memory which the CPU can safely read from. This can be used for when you are dealing with Video Capture for example.

 

So at the end of the day, yes you can create things anywhere you want depeneding on what you are trying to achieve and how do you want to access that data.




#5247048 DX12 Multithreaded Rendering Architecture

Posted by on 16 August 2015 - 11:17 PM

The way i am handling that in my code base is that i have  1 thread for GraphicsSubmission and 1 thread for ComputeSubmission and N threads for CommandList build up. Two CommandQueueList Class which i create that are thread safe so adding and removing command list from multiple threads there will be no clash. The graphics/compute thread just spin and checks to see if their appropriate command queue have any command list to execute. Doing it like that you can keep filling up new command list without having to wait on the gpu to execute them.




#5243953 Windows 10 install but no d3d12.h can be found

Posted by on 31 July 2015 - 11:26 PM

Thanks Guys. VS2015 installed the windows 10 SDK. Now i can see it.




#5240064 Making my model class Vertex Independent

Posted by on 13 July 2015 - 07:16 AM

Explicit Or any attributes that your vertex support have. Then when you create them you use a stride that matches all the Attributes that your vertex have. For example if you only have postion and normal. You can do something like Model.AttributeType = POSITION|NORMAL. and when you create your memory to hold the vertices you can look at the attributes you have in AttributeType and create a stride that matches that type. For example you know position type would 12 bytes and Normal is also 12 bytes as well in that case your stride would be 24 bytes.




#5238198 Update a specific region of the render target?

Posted by on 03 July 2015 - 09:43 AM

If you look at the graphics pipeline  you will notice that the PixelShader executes after the rasterize state. So if you set the Scissor rect,it will not execute the pixel shader on any of those pixels that falls out of that rect region.




#5222690 2d Picking with overlapping, transparent images

Posted by on 11 April 2015 - 09:04 PM

Another faster way you can do it is that as you project the point and checking if a point is withing an object bound. Just keep track of the smallest value. Then once you are done you can map that smallest value to a map. Kind of like map<int,object>. I hope this make sense to you otherwise I can post some sample code to show you what I mean.


#5222689 2d Picking with overlapping, transparent images

Posted by on 11 April 2015 - 09:02 PM

you create a collision map that map whether a point is part of an object or not by first projecting the point on each plane of the objects that you are interested in. Then when you are done you can do distance check and grab the one with the smallest Value.


#5161706 Getting perspective Frustum in world coordinates

Posted by on 20 June 2014 - 07:33 AM

Why don't you extract the 6 planes after you multiply world by projection. That would give you the enclosed frustum in world space.


#5160403 Creating Camera Bounding Frustum From View and Projection Matrix

Posted by on 13 June 2014 - 06:59 PM

You just need to multiply the ViewMatrix*Projection Matrix. Then you need to extra the 6 planes that makes up the frustum.

 

//This is Column Major matrix.

//If you have row based then you would flip the multiplication order.

Matrix4x4 ViewProjection = ProjectionMatrix*ViewMatrix;
    
    Plane& right = GetPlaneRight();
    right.normal.x=ViewProjection.m14-ViewProjection.m11;
    right.normal.y=ViewProjection.m24-ViewProjection.m21;
    right.normal.z=ViewProjection.m34-ViewProjection.m31;
    right.distance=ViewProjection.m44-ViewProjection.m41;
    right.Normalized();

    Plane& left = GetPlaneLeft();
    left.normal.x=ViewProjection.m14+ViewProjection.m11;
    left.normal.y=ViewProjection.m24+ViewProjection.m21;
    left.normal.z=ViewProjection.m34+ViewProjection.m31;
    left.distance=ViewProjection.m44+ViewProjection.m41;
    left.Normalized();

    Plane& top = GetPlaneTop();
    top.normal.x=ViewProjection.m14-ViewProjection.m12;
    top.normal.y=ViewProjection.m24-ViewProjection.m22;
    top.normal.z=ViewProjection.m34-ViewProjection.m32;
    top.distance=ViewProjection.m44-ViewProjection.m42;
    top.Normalized();

    Plane& bottom = GetPlaneBottom();
    bottom.normal.x=ViewProjection.m14+ViewProjection.m12;
    bottom.normal.y=ViewProjection.m24+ViewProjection.m22;
    bottom.normal.z=ViewProjection.m34+ViewProjection.m32;
    bottom.distance=ViewProjection.m44+ViewProjection.m42;
    bottom.Normalized();

    Plane& front = GetPlaneFront();
    front.normal.x=ViewProjection.m14-ViewProjection.m13;
    front.normal.y=ViewProjection.m24-ViewProjection.m23;
    front.normal.z=ViewProjection.m34-ViewProjection.m33;
    front.distance=ViewProjection.m44-ViewProjection.m43;
    front.Normalized();

    Plane& back = GetPlaneBack();
    back.normal.x=ViewProjection.m14+ViewProjection.m13;
    back.normal.y=ViewProjection.m24+ViewProjection.m23;
    back.normal.z=ViewProjection.m34+ViewProjection.m33;
    back.distance=ViewProjection.m44+ViewProjection.m43;
    back.Normalized();




#5153593 Vertex buffers in DirectX 11

Posted by on 14 May 2014 - 10:18 AM

Why don't you create an orthographic matrix using the screen resolution for your width and height. That way you can specify your coordinate directly in pixel coordinate.




#5153592 clear only partial bits of stencil buffer

Posted by on 14 May 2014 - 10:16 AM

The entire stencil must be cleared at once. you cannot just clear a portion of it.




#5151014 Per-pixel displacement mapping GLSL

Posted by on 02 May 2014 - 05:09 PM

 try flipping the binormal and see if it has any effects.




#5108896 DirectX11 Swap Chain Format

Posted by on 13 November 2013 - 12:10 AM

 


So what about vista or windows 7 with directx 10/11 where flip sequential might not be available or using say discard as the presentation model?

It will use an additional BitBlit() to copy the DX surface to an intermediate DWM surface, which is slower. But same principal holds - if the swap-chain format matches the screen-format, this operation will be faster. When using the BitBlit mode, you also have more options for swap-chain formats.

 

This is not completely true for windows 7. As long your backbuffer matches your front buffer and you have your swap chain set to full screen. It will not bitblt, but swap the backbuffer with the front. The only time it bitblt is when the swapchain is in window mode or when the swap chain back buffer does not match the front buffer width/heigh and format.






PARTNERS