• Create Account

# Zaoshi Kaba

Member Since 04 Nov 2012
Offline Last Active Today, 10:47 AM

### #5204497Rendering .obj Model in DirectX 11

Posted by on 15 January 2015 - 09:46 AM

After trying to solve the problem for awhile, I can now see the mesh, however I see 2 triangles instead of a box (incomplete box)

I guess the problem is with the indices, I have 8 vertices, how do I calculate the indices for the box?

```// Read in the faces.
if(input == 'f')
{
fin.get(input);
if(input == ' ')
{
// Read the face data in backwards to convert it to a left hand system from right hand system.
fin >> faces[faceIndex].vIndex3 >> input2 >> faces[faceIndex].tIndex3 >> input2 >> faces[faceIndex].nIndex3
>> faces[faceIndex].vIndex2 >> input2 >> faces[faceIndex].tIndex2 >> input2 >> faces[faceIndex].nIndex2
>> faces[faceIndex].vIndex1 >> input2 >> faces[faceIndex].tIndex1 >> input2 >> faces[faceIndex].nIndex1;
faceIndex++;
}
}
```

Which assumes 3 vertices per face, aka. triangle, however in your .obj file:

```g Box001
usemtl Material__26
s 2
f 1/1/1 2/2/1 3/3/1 4/4/1
s 4
f 5/4/2 6/1/2 7/2/2 8/3/2
s 8
f 1/4/3 4/1/3 6/2/3 5/3/3
s 16
f 4/4/4 3/1/4 7/2/4 6/3/4
s 32
f 3/4/5 2/1/5 8/2/5 7/3/5
s 64
f 2/4/6 1/1/6 5/2/6 8/3/6
# 6 polygons
```

each face (polygon) contains 4 vertices.

You have 2 choices here:

1. load correct number of vertices for each face / polygon and triangulate them;
2. when you export .obj file there should be an option to triangulate meshes / faces / polygons, use it to generate triangles instead of arbitrary polygons.

### #5204296Rendering .obj Model in DirectX 11

Posted by on 14 January 2015 - 02:43 PM

You removed most of temp files from your project, I'll give you that. Usually people are unable to do even that.

I am unable to compile your project because I don't have D3DX, but there is something I have noticed:

1. you aren't doing any transformations in your vertex shader, meaning it's not being transformed into the screen;
2. your box is relatively far from (0, 0, 0) point, it won't be visible with 'default' camera transform.

### #5202559whats wrong with my directx 11 project?

Posted by on 07 January 2015 - 05:23 AM

Debugger does give a certain answer.

Your program seems to get stuck inside this loop (ModelClass.cpp):

```	while (input != ':')
{
fin.get(input);
}
```

However I am unable to compile your code so there's no way for me to provide further help.

### #5202556Compile Error C2065: 'identifier' : undeclared identifier, C++ Scope...

Posted by on 07 January 2015 - 04:58 AM

As vstrakh pointed out there's a mismatch between line numbers, so I'll just ignore that.

According to first error unique_ptr is undefined. According to C++ reference it's defined in <memory> header which I don't see you including. That could be source of your problem.

### #5199979[DX11] writing RWTexture2DArray in pixel shader

Posted by on 25 December 2014 - 12:46 PM

For pixel shaders, UAVStartSlot should be equal to the number of render-target views being bound.

### #5199386How was my operator overload working when I forgot to return *this

Posted by on 21 December 2014 - 04:06 AM

Some bugs have a mysterious way to sense release date and crash the software just before that.

Schrodinger's bug.

### #5196233Win 10 Tech Preview Visual Studio 2015 and Direct2D tutorial

Posted by on 04 December 2014 - 06:21 AM

There's no attachment so I'll just list typical problems:

1. DirectX SDK comes with Windows SDK, which comes with Visual Studio. This means you don't need to install SDK separately. Visual Studio is all you need to use DirectX. If you have old SDK you will have to remove it;
2. Microsoft got rid of D3DX, which had texture loading, meshes, and a lot of other stuff. Therefore you have to implement these yourself and old samples don't work anymore. There's DirectX Tool Kit but I think you'll still have to make some changes to make D3DX code work;
3. DXUT is gone as well, which heavily relied on D3DX and been used in a lot code samples;
4. Math API has been updated, so old D3DX math functions don't work. See DirectXMath.h include and MSDN.

### #5186753normal map generating

Posted by on 13 October 2014 - 02:02 PM

This is very possible.

This has been discussed in some other topic.

It is possible but it won't be real normal map. You'll just end up with some fake effect which most likely be on a scale from bad to terrible.

### #5186738normal map generating

Posted by on 13 October 2014 - 12:23 PM

You cannot make normal map like that.

### #5185959Formula for Exponential Growth

Posted by on 09 October 2014 - 05:02 AM

Formula:

y = 10 ^ (2 ^ ((x - 1900) / 2 / 28) * (70 / 12) - 10)

Where x is 1900 to 2100.

### #5185929Formula for Exponential Growth

Posted by on 09 October 2014 - 02:55 AM

It's exponent with certain scaling on both axes.

Red dots represent computing power which follows Moore's Law (x2 every 2 years).

e^x also has similar shape.

I think you're overcomplicating problem by trying to create function based on data instead of making a guess based on visual information.

Not to mention you have no accurate data to begin with.

### #5185114Two Questions about DirectX 11 (XMVECTOR & Creating Input Layouts)

Posted by on 05 October 2014 - 07:16 AM

If you pass pointer you'll have to load value from memory by pointer, however if you pass your vector by value there's a good chance it will be passed in register and you won't need to access memory, which is way more faster and efficient.

### #5181103c++ Performance boost needed

Posted by on 17 September 2014 - 02:12 PM

1. Yes, operator[] is a little slower, especially if you have exceptions/etc turned on; it checks whether range is valid, etc. However your loop isn't big enough to make a any noticeable difference.
2. std::clock() has horrible accuracy. Even if there is performance difference you won't notice until it's huge or it'll round wrong way giving invalid data, ex. execution time can increase by 1% by rounding will change from 16ms to 32ms. Pointers aren't "faster" or "slower", however when misused they definitely can be slower because of cache misses.
3. I have suspicions that your handConflictsBoard() function passes values instead of references, thus copying a lot of data when it's not necessary which is likely source of your slowdown.

​If you want to make your code faster first you need to figure which part is the slowest and then see how you can improve it. Optimizing random code parts isn't likely to give significant difference.

### #5180215Preprocessor query

Posted by on 14 September 2014 - 04:45 AM

Won't this turn __COUNTER__(a) into a string instead of calling macro and turning result into a string?

There's some command line parameter to output preprocessed file, that way you can see result you're getting instead of playing guessing game.

### #5179813Which algorithm is more efficient for visibility culling? BSP or OCTree?

Posted by on 12 September 2014 - 02:56 AM

brute force, just iterate over the set of renderables and cull them against the view frustum. Even better, pack the bounding boxes with handles back to the owner into an array and iterate that much more cache efficient, minimal branching (in fact, you can delay branching till the end in most cases).

To backup Washu I can say I've done thesis on view frustum culling and bruteforce method culls 340,000 AABBs in 1 millisecond. If this isn't sufficient you might have different problems.

PARTNERS