Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
AgeCommit message (Collapse)Author
2022-09-09Fix Clang warning about braces around initializationSergey Sharybin
2022-09-07Mikktspace: Optimized port to C++Lukas Stockner
This commit is a big overhaul to the Mikktspace module, which is used to compute tangents. I'm not calling it a rewrite since it's the result of a lot of iterations on the original code, but pretty much everything is reworked somehow. Overall goal was to a) make it faster and b) make it maintainable. Notable changes: - Since the callbacks for requesting geometry data were a big bottleneck before, I've ported it to C++ and made it header-only, templating on the data source. That way, the compiler generates code specific to the caller, which allows it to inline the data source and specialize for some cases (e.g. subd vs. non-subd in Cycles). - The one input parameter, an optional angle threshold, was not used anywhere. Turns out that removing it allows for considerable algorithmic simplification, removing a lot of the complexity in the later stages. Therefore, I've just removed the option in the new code. - The code computes several outputs, but only one (the tangent itself) is ever used in Blender. Therefore, I've removed the others to simplify the code. They could easily be brought back if needed, none of the algorithmic simplifications are conflicting with them. - The original code had fallback paths for many steps in case temporary memory allocation fails, but that never actually gets used anyways since malloc() doesn't really ever return NULL in practise, so I removed them. - In general, I've restructured A LOT of the code to make the algorithms clearer and make use of some C++ features (vectors, std::array, booleans, classes), though there's still some of cleanup that could be done. - Parallelized duplicate detection, neighbor detection, triangle tangent computation, degenerate triangle handling and tangent space accumulation. - Replaced several algorithms with faster equivalents: Duplicate detection uses a (concurrent) hash set now, neighbor detection uses Radixsort and splits vertices by index pairs etc. As for results, the exact speedup depends on the scene of course, but let's consider the file from T97378: - Blender 3.1 (before D14675): 6.07sec - Blender 3.2 (with D14675): 4.62sec - rBf0a36599007d (last nightly build): 4.42sec - With this commit: 0.90sec This speedup will mostly be noticed at the start of Cycles renders and, even more importantly, in Eevee when doing something that changes the geometry (e.g. animating) on a model using normal maps. Differential Revision: https://developer.blender.org/D15589
2022-04-23Mikktspace: Reduce number of data queries to callerLukas Stockner
The current code for computing tangents is not exactly fast. This has been a long-standing issue, and recently came up again with T97378. The main bottleneck is fetching the mesh data, since it's handled through a callback system and each vertex might have its data queried dozens of times. I've tried a lot of things to optimize `mikktspace.c`, but unfortunately most weren't that useful: - Vectorizing SVec3 gives a ~5% speedup, but I'm not sure if the additional ~70 lines of code are worth it - Keeping an internal copy of the data instead of re-querying all the time helps a lot (~50-60% time reduction), but requires a lot of extra memory (~100 byte per face) - Going C++ and replacing the internal quicksort with std::sort shows no difference - Restructuring the entire file to be a header-only library so that the callbacks can be inlined gives ~10% reduction, but is a major change and deviation from the original library In the end, two simple fixes that actually help remain: - Don't re-query the number of faces in each loop iteration - Don't bother looking for identical vertices if there's only one vertex with that hash With this, time for the test case in T97378 goes from 6.64sec to 4.92sec. It's something I guess. I feel like completely refactoring this library would not be a bad idea at some point, but for now it does the job... Differential Revision: https://developer.blender.org/D14675
2022-03-18Cleanup: Compilation warningsSergey Sharybin
Mainly -Wset-but-unused-variable. Makes default compilation on macOS way less noisy. Differential Revision: https://developer.blender.org/D14357
2022-02-11File headers: use SPDX for Zlib licenseCampbell Barton
2022-02-11File headers: SPDX License migrationCampbell Barton
Use a shorter/simpler license convention, stops the header taking so much space. Follow the SPDX license specification: https://spdx.org/licenses - C/C++/objc/objc++ - Python - Shell Scripts - CMake, GNUmakefile While most of the source tree has been included - `./extern/` was left out. - `./intern/cycles` & `./intern/atomic` are also excluded because they use different header conventions. doc/license/SPDX-license-identifiers.txt has been added to list SPDX all used identifiers. See P2788 for the script that automated these edits. Reviewed By: brecht, mont29, sergey Ref D14069
2021-10-04Cleanup: pass arguments as constCampbell Barton
2021-06-24Cleanup: use '#if 0' for commented code-blockCampbell Barton
2021-05-23Docs: Add readme for mikktspaceAaron Carlisle
2021-02-05Cleanup: correct spelling in commentsCampbell Barton
2020-10-19Spelling: It's Versus ItsHarley Acheson
Corrects incorrect usage of contraction for 'it is', when possessive 'its' was required. Differential Revision: https://developer.blender.org/D9250 Reviewed by Campbell Barton
2020-03-19Cleanup: `make format` after SortedIncludes changeDalai Felinto
2020-01-31Fix more undefined behavior in tangent space computationBrecht Van Lommel
Ref D6677
2020-01-27Fix undefined behavior in tangent space computationSimon G
Use an improved implementation for circular shift. Differential Revision: https://developer.blender.org/D6677
2019-10-03Cleanup: unused structs, struct membersCampbell Barton
2019-05-01Cleanup: comments (long lines) in mikktspaceCampbell Barton
2019-04-17ClangFormat: format '#if 0' code in intern/Campbell Barton
2019-04-17ClangFormat: apply to source, most of internCampbell Barton
Apply clang format as proposed in T53211. For details on usage and instructions for migrating branches without conflicts, see: https://wiki.blender.org/wiki/Tools/ClangFormat
2019-04-14CMake: prepare for BLENDER_SORTED_LIBS removalCampbell Barton
No functional change, this adds LIB definition and args to cmake files. Without this it's difficult to migrate away from 'BLENDER_SORTED_LIBS' since there are many platforms/configurations that could break when changing linking order. Manually add and enable WITHOUT_SORTED_LIBS to try building without sorted libs (currently fails since all variables are empty). This check will eventually be removed. See T46725.
2019-02-18doxygen: add newline after \fileCampbell Barton
While \file doesn't need an argument, it can't have another doxy command after it.
2019-02-06Cleanup: remove redundant doxygen \file argumentCampbell Barton
Move \ingroup onto same line to be more compact and make it clear the file is in the group.
2019-02-05Cleanup: remove contributors for CMake filesCampbell Barton
Following removal from C source code. See: 8c68ed6df16d8893
2018-06-29Cleanup: trailing newlinesCampbell Barton
2018-06-17Cleanup: trailing space in CMake filesCampbell Barton
2017-11-17Mikktspace: Speed up the merging of identical verticesLukas Stockner
Previously, Mikktspace just bucketed the vertices based on one spatial coordinate and then ran full pairwise comparisons inside each bucket. However, since models are three-dimensional, the bucketing has a massive false-positive rate, and since pairwise comparison is O(n^2), the merging process is very slow. But, since we only care about exactly identical vertices, there is a much more efficient approach - we can just hash all values belonging to each vertex and form buckets based on the hash. Since the hash has 32 bits and considers all values, false-positives are very unlikely - and since both hashing and the radixsort that's used for bucketing are O(n), both asymptotical and real-world performance (as well as code complexity) are significantly improved.
2017-09-19Fix T52818: Tangent space calculation is really slow for high-density mesh ↵Sergey Sharybin
with degenerated topology Now we replace O(N^2) computational complexity with O(N) extra memory penalty. Memory is much cheaper than CPU time. Keep in mind, memory penalty is like 4 megabytes per 1M vertices.
2017-09-19Mikkspace: Cleanup, reduce indentation levelSergey Sharybin
2017-08-25Fix for fix (tm): Residue of the debug codeSergey Sharybin
2017-08-25Fix mistake in previous tangent space optimizationSergey Sharybin
2017-08-25Another optimization of tangent space calculationSergey Sharybin
Don't use quick sort for small arrays, bubble sort works way faster for small arrays due to cache coherency. This is what qsort() from libc is doing actually. We can also experiment unrolling some extra small arrays, for example 3 and 4 element arrays. This reduces tangent space calculation for dragon from 3.1sec to 2.9sec.
2017-08-25Optimize tangent space calculation by inlining functionsSergey Sharybin
Brings tangent space calculation from 4.6sec to 3.1sec for dragon model in BI. Cycles is also somewhat faster, but it has other bottlenecks. Funny thing, using simple `static inline` already gives a lot of speedup here. That's just answering question whether it's OK to leave decision on what to inline up to a compiler..
2017-08-03mikktspace: minor optimizationCampbell Barton
Add a safe version of normalize since all uses of normalize did zero length checks, move this into a function. Also avoid unnecessary conversion. Gives minor speedup here (approx 3-5%).
2016-10-06Fix T49523: very slow normal map tangent computation for rendering in 2.78.Brecht Van Lommel
2016-09-18Fix T49384: crash in tangent space calculation with NaN mesh vertices.Brecht Van Lommel
2016-03-13Cleanup: warningCampbell Barton
2016-01-04Remove SCons building systemSergey Sharybin
While SCons building system was serving us really good for ages it's no longer having much attention by the developers and started to become quite a difficult task to maintain. What's even worse -- there started to be quite serious divergence between SCons and CMake which was only accumulating over the releases now. The fact that none of the active developers are really using SCons and that our main studio is also using CMake spotting bugs in the SCons builds became quite a difficult task and we aren't always spotting them in time. Meanwhile CMake became really mature building system which is available on every platform we support and arguably it's also easier and more robust to use. This commit includes: - Removal of actual SCons building system - Removal of SCons git submodule - Removal of documentation which is stored in the sources and covers SCons - Tweaks to the buildbot master to stop using SCons submodule (this change requires deploying to the server) - Tweaks to the install dependencies script to skip installing or mentioning SCons building system - Tweaks to various helper scripts to avoid mention of SCons folders/files as well Reviewers: mont29, dingto, dfelinto, lukastoenne, lukasstockner97, brecht, Severin, merwin, aligorith, psy-fi, campbellbarton, juicyfruit Reviewed By: campbellbarton, juicyfruit Differential Revision: https://developer.blender.org/D1680
2015-11-23CMake: use -Wshadow warning for C sourceCampbell Barton
C source now builds without shadowing, enable with GCC by default.
2013-12-22Style Cleanup: remove preprocessor indentation (updated wiki style guide too)Campbell Barton
2013-09-09fix [#36685] crash calculating tangent space data on degenerate geometryCampbell Barton
the error was that the range check was done on the float before converting to an int. now convert to and int first and ensure a valid range on that.
2013-08-07code cleanup: some structs were declaring data when only typedef's were ↵Campbell Barton
intended, make local vars and functions static.
2012-12-17Added GPL header to sconscripts!Bastien Montagne
Also changed shebang to '#!/usr/bin/env python', this is more portable across unixes...
2012-09-20code cleanup: remove unused macros, commet some which may be useful later - ↵Campbell Barton
or good to keep for completeness. quieted some warnings and add flags -Wmissing-include-dirs and -Wno-div-by-zero to cmake/gcc
2012-09-15quiet -Wmissing-prototypes warnings, and enable this warning by default for ↵Campbell Barton
C with gcc. helps for finding unused functions and making functions static, also did some minor code cleanup.
2012-06-07style cleanupCampbell Barton
2012-06-05style cleanupCampbell Barton
2012-04-28style cleanup: changes to brace placement / newlines - for/while/if/switchCampbell Barton
2011-12-23Code cleanup: fix some clang static checker warnings.Brecht Van Lommel
2011-10-23remove $Id: tags after discussion on the mailign list: ↵Campbell Barton
http://markmail.org/message/fp7ozcywxum3ar7n
2011-10-06set mikktspace functions as static which are not used externally.Campbell Barton
2011-07-16print an error message if Python.h can't be found for cmake and scons since ↵Campbell Barton
its such a common problem.