Giter Site home page Giter Site logo

rasterizer's People

Contributors

rawrunprotected avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

rasterizer's Issues

centroidAssignment should be initialized

Occluder.cpp: 71:

		for (int j = 0; j < quadNormals.size(); ++j)
		{
			int k = centroidAssignment[j];
				
                        centroids[k] = _mm_add_ps(centroids[k], quadNormals[j]);
		}

centroidAssignment should be initialized, otherwise centroids[k] may overflow.

Crash with low-poly occluders

Do:

Create a single occluder which consists of a tetrahedron mesh (4 vertices, 12 indices).

Observe:

A crash in Occluder::bake().

Hints:

The size of std::vector<__m128> orderedVertices can be less than 32 which means this code will crash:

__m128 v0 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j +  0], refMin), invExtents);
__m128 v1 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j +  4], refMin), invExtents);
__m128 v2 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j +  8], refMin), invExtents);
__m128 v3 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j + 12], refMin), invExtents);
__m128 v4 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j + 16], refMin), invExtents);
__m128 v5 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j + 20], refMin), invExtents);
__m128 v6 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j + 24], refMin), invExtents);
__m128 v7 = _mm_mul_ps(_mm_sub_ps(orderedVertices[i + j + 28], refMin), invExtents);

camera move far from scene app must crushed

// Main.cpp line 186
// Sort front to back
#ifdef BUG
std::sort(begin(g_occluders), end(g_occluders), [&](const auto& o1, const auto& o2) {
__m128 dist1 = _mm_sub_ps(o1->m_center, g_cameraPosition);
__m128 dist2 = _mm_sub_ps(o2->m_center, g_cameraPosition);
return _mm_comile_ss(_mm_dp_ps(dist1, dist1, 0x7f), _mm_dp_ps(dist2, dist2, 0x7f));
});
#else
std::sort(begin(g_occluders), end(g_occluders), [&](const auto& o1, const auto& o2) {
__m128 center1 = o1->m_center;
__m128 center2 = o2->m_center;
float dx1 = center1.m128_f32[0] - g_cameraPosition.m128_f32[0];
float dy1 = center1.m128_f32[1] - g_cameraPosition.m128_f32[1];
float dz1 = center1.m128_f32[2] - g_cameraPosition.m128_f32[2];
float dx2 = center2.m128_f32[0] - g_cameraPosition.m128_f32[0];
float dy2 = center2.m128_f32[1] - g_cameraPosition.m128_f32[1];
float dz2 = center2.m128_f32[2] - g_cameraPosition.m128_f32[2];
return dx1 * dx1 + dy1 * dy1 + dz1 * dz1 < dx2 * dx2 + dy2 * dy2 + dz2 * dz2;
});
#endif//

BUG report:
intel 9700k win10 64bits VS2015 debug version,
while camera move far from scene app must crushed,
i speculate sort function using SSE may inaccurate so std::sort make some element ( unique_ptr ) in g_occluders to nullptr;
replace with FPU instructions seems fix it up.

Why is the "greaterArea" used as the division when calculating the depthpane

Why is the "greaterArea" used as the division when calculating the depthpane?
Looking at the code (Rasterizer.cpp Line.947), it selects one of the two triangles of the quad by comparing the area projected on the screen plane. Why?
// Compute screen space depth plane
__m256 greaterArea = _mm256_cmp_ps(_mm256_andnot_ps(minusZero256, area1), _mm256_andnot_ps(minusZero256, area2), _CMP_LT_OQ);
Must only one of the two triangles contribute to the final depthPlane?
What if there is a quad composed of two triangles with similar large areas?
If I have an understanding error, please point it out.

Backface culling control

What would be the simplest way to integrate backface culling control (on/off) into rasterize()?

Sometimes it is useful to run the code on "bad" geometry.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.