Comments (1)
Добрый день, собственно, это и есть проблема округления.
Попробуйте перед отрисовкой всех треугольников округлить экранные координаты вершин.
ДС
On 15-12-22 03:51:39, Bogdan wrote:
Доброго времени суток!
Хочу сказать спасибо за ваши статьи на хабре о компьютерной графике - это то,
что нужно таким новичкам, как я
И, как полагается, у меня возникли некоторые вопросы по статье №3, и, когда у
вас появится свободное время, прошу ответитьВ комментариях вы привели пример картинки с "дырками", когда mr guyfawkes
спросил у вас насчет хакаPx = j; Py = t0y+i; // a hack to fill holes (due to int cast precision problems)
Вы указали, что это ошибка с округлениями, и добавили на репозиторий
конструктор копирования для Vec3i с округлениемВ чем моя проблема: 1png в прикрепленных
Вроде бы очень похоже на вашу картинку с "дырками" НО, я использую double
представление точки, те все коодинаты:struct vertice { double x; double y; double z;
те как видите, округлений особо нет(и да, я понимаю, что это медленне по
сравнению с int)Поскольку у меня координаты типа [-10, 10], то и прохожусь я по по координатам
с помощью такого костыля:for (double y = fy; y < ty; y += m_delta)
где m_delta - некое магическое число(шаг), которое для 1png установлено в 0001
если уменьшить шаг, то количество дырок уменьшается, но не пропадает(2png - шаг
установлен в 000035) Сами понимаете, что производительность падает при таком
решении(у меня, для сравнения, 026105 сек для первого изображения, и 171324 сек
для второго)Нужна ваша конструктивная критика моих решений
вот код метода рисования треугольника: github1png
2png—
Reply to this email directly or view it on GitHub.*
from tinyrenderer.
Related Issues (20)
- [not issue] Porting of tinyrenderer to Atari 2600 HOT 1
- Implications of negative dot product of normal to the triangle and light direction HOT 3
- How to make TGA pictures HOT 1
- Incompatible with modern C++? HOT 3
- Lighting code in lesson 2 is not working properly
- Drawing triangle compilation error HOT 2
- Why does the rendered line break when it is vertical —— lesson 1 HOT 2
- Question about transformation of normal vectors in Lesson5 HOT 2
- My picture is brighter
- Where is the function of face() HOT 1
- Typo in Lesson 5
- 我渲染得到的结果是这样的,有人能告诉我这是哪里出现问题了吗 HOT 3
- Question about zbuffer HOT 2
- How to do the shadow mapping after perspective deformations? HOT 1
- Confused about design of the articles HOT 1
- In lesson2,something wrong in function `barycentric` when i run task in Vscode and i fix it. HOT 2
- The compilation error of lambda expressions in lesson 2 HOT 1
- Holes in fill a triangle using coordinates of pixel left bottom corner HOT 1
- About the function of face() HOT 1
- LLVM linker error HOT 6
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinyrenderer.