# BornToCode

Member

736

1185 Excellent

• Rank
1. ## Camera Matrix and Axis Vectors

If your matrix is row major then each basic would be a row. and the last row would be your translation. If you matrix is column major then each basic would be a column and the last column would be your translation. Now in the case of the ViewMatrix, it is the Transpose of the 3x3 row or 3x3 column depending on whether you are using row major or column major because the ViewMatrix is the Transpose of your world in that case if you have a row major matrix then your right axis would be your first column. Hope it makes sense.One thing to always remember is that OpenGL/DirectX always expect element 12,13,14,15 of the matrix to be translation. However you decide to use the other elements is completely up to you, as long you remain consistent.
2. ## Engine Lighting

When you use shaders you program the light yourself. So you can store light information into buffers/textures for example which can then be retrieve in the vertex/pixelshader to process more than 8 lights. But if you are using the fixed pipeline you cannot use more than 8 lights. If you want to use more than 8 lights you will have to render the scene more than once with additive blending.
3. ## How the 'perspective division' should be done?

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.
4. ## Working for a startup.

The medical job is right next to my house. About 2 miles away. The game company is about 30 miles a day.@Orymus3. That is exactly the problem, i am kind of like if i take the cad one, it will be stable but very boring work, but i will have more stability there. On the other hand the game company one sounds awesome, but i had bad experience in the past working for bigger game company and assume that working for a start up is probably worse. I do not want to find myself working everyday like 9 to 10pm where i am not spending time with my kids and wife.
5. ## Working for a startup.

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.
6. ## question about data transfer between memory and graphics card memory...

What exactly are you trying to do.? glBufferData updates the entire buffer of data. glBufferSubData let you update a section the buffer which can be very helpful when you have a dynamic buffer and you just want to update a section of the buffer, while the gpu is working on some other section. The only reason it would not be efficient is if you are locking the entire buffer every frame and replacing the whole thing everytime then yes that will be inefficient because you will stall and you want to prevent that. But what you can do is make the buffer like twice or three times the size. That way you can map one section of it and update that while the GPU is currently drawing another section.With that there will be no stalls as long you can keep feeding data that the GPU is not currently working with, that is where glBufferSubData comes in handy, because it allows you to do exactly that.
7. ## Bvh player - blank!

Just to extend a bit on what L.Spiro mention. The only difference between opengl and direct x is that if you are using their build in fixed pipeline matrix operation. The multiplication is done by multiplying column*row and in the case of direct x it is done by row*column. But the memory layout is the same on both. Element 12,13,14 represent position for both gl/dx. That is the reason why in DirectX you would do something like Rotate*Scale*Translate but in GL it would be Translate*Rotate*Scale to get the same result. Row major multiplication are perform left to right and column major are perfomed right to left.
8. ## OpenGL Khronos, y u no triple buffer?

Like L.Spiro mention. You can create an aditional FrameBuffer object and use those as your extra buffers.
9. ## DirectX12 Minumum Allocation size.

I have gotten around it by creating a single buffer of 64k then just pass back a pointer that points to the current location in that buffer that i want to put the info. So the first object uses the first 32k and the second object uses the starting address+offset. Whenever i Map my resource i automaticaly add the offset to the starting address depending on the object i want to change. That way the resource is bound once and i can draw the two objects without any issues. That is what i meant when i say that you can write a system that can work around the limitation, you just have to managed it which is not a problem for me. I have written a ton of memory management system. . To be honest i really like the way they have it, because now you can tell exactly how much memory you are using.
10. ## DirectX12 Minumum Allocation size.

My beef was that I cannot insert object anywhere I want on that heap of 64k. For example on the cpu side when you write your own memory manager you can put things anywhere you want. So I was not expecting the gpu to have that kind of limitation. But just like I said it is no biggie because you can create a memory management system that works around that.
11. ## [D3D12] Barriers and Fences

Resource barrier are a way to tell the GPU that you are switching the resource state. You see on the GPU a Resource is just that a resource. It can be in many different states. So resource barrier just let you set the resource state you want it to be before modifying that state.
12. ## DirectX12 Minumum Allocation size.

It looks like even for a buffer with a width 1 ID3D12Device::GetResourseAllocationInfo always returns the size/aligment as 64K. That is not a problem. The issue i am having is that any resource created on that heap needs to respect the aligment. So if put a resource at Offset 0 and try to put another resource at 32k for example. The resource at 0 will work but when i try to put something at 32k, it generates an error that say all resource needs to respect the boundary. So if i have two distinct buffers of let's say 32k each, there is no way i can create two distinct resources with the exact amout of memory i want to use because of that issue. One buffer would need to be at HeapOffset 0 and the other at HeapOffset 64k. Also now i would need to create a Heap with a size of 64k*2 in order to put two 32k buffers in there. Now i just waste 32k on each side. I know i can overcome this by creating one Huge buffer and and just point to the buffer location that i want to draw. But i kind of find it very annoying that the API does not let you insert the data into any location in a Heap.   All in all i know you can write a system that managed the heaps similar to how you would do it in the CPU side if you were to write your own memory management system. That way that limitation does not seem like it exist.
13. ## DX12 DX12 Some structure have Int type which uses a specific enum.

Looking more at the D3D12.h header it seems like this is the only place where they have that mistake. So i guess it is a typo on someones part.
14. ## DX12 DX12 Some structure have Int type which uses a specific enum.

I do not know why microsoft would do this. I think it would have make things easier to know which parameter they took, especially when you have a enum define for something. Then in the structure instead of defining one of the attribute with that enum they pass an Int instead. A good example of that is enum D3D12_COMMAND_QUEUE_PRIORITY     {         D3D12_COMMAND_QUEUE_PRIORITY_NORMAL    = 0,         D3D12_COMMAND_QUEUE_PRIORITY_HIGH    = 100     }     D3D12_COMMAND_QUEUE_PRIORITY; typedef struct D3D12_COMMAND_QUEUE_DESC     {     D3D12_COMMAND_LIST_TYPE Type;     INT Priority;     D3D12_COMMAND_QUEUE_FLAGS Flags;     UINT NodeMask;     }      The Priority flag is a D3D12_COMMAND_QUEUE_PRIOORITY why the heck would they pass an Int. I know at the end of the day an enum is just an Int, but it would have been more friendly and i would not need to look at the documentation to make sure that the correct Int values that can be passed are D3D12_COMMAND_QUEUE_PRIORITY. I am pretty  sure they have similar issues throughout the API.
15. ## [D3D12] Create anything anywhere?

Yes you can specify the location but if you try to use an upload heap or read back in L1 it will fail.