Using ones complement for detecting if transform has been applied was confusing
and led to several bugs. With this proper checks are made. Also added a few
transforms where they were missing, mostly affecting baking and displacement
when `P` is used in the shader (previously `P` was in the wrong space for
these shaders)
Bump mapping was happening in world space while displacement happens in object
space, causing shading errors when displacement type was used with bump mapping.
To fix this the proper transforms are added to bump nodes. This is only done
for automatic bump mapping however, to avoid visual changes from other uses of
bump mapping. It would be nice to do this for all bump mapping to be consistent
but that will have to wait till we can break compatibility.
Object coordinates can now be used in the displacement shader and will give
correct results, where as before bump mapping was calculated from the displace
positions and resulted in incorrect shading.
This works by evaluating the shader in two parts, first bump then surface, and
setting the shader state to match what it would be if the surface was
undisplaced for the bump shader evaluation. Currently only `P` is set as if
undisplaced, but other shader variables could be set as well, such as `I` or
`time`. Since these aren't set to anything meaningful for displacement I left
them out of this patch, we can decide what to do with them separately.
Storing multiple copies of a shader was needed when the displacement method was
a mesh option and could be different for each mesh. Now that its a shader option
this is unnecessary.
Sets vertex creases to match how Blender handles vertexes on the edge of a mesh.
There's probably more inconsistencies but I'll see about handling those later.
Displacement is now a per material setting, which means old files will have to
be updated if they had used displacement. Cool side effect of this change is
material previews now show displacement.
This alleviates a ~5% performance regression caused by calling patch_eval_*
functions multiple times to calculate differentials. Differentials for
subdivided attributes are now calculated directly from the limit.
Thanks to Lukas Stockner for checking my math.
Sergey's bvh work made use of and removed the same unused bytes that
were being used for storing patch info, so this info now has to be
moved elsewhere. Unfortunately we use up two more textures for this.
The switch from std::vector to ccl::array in Mesh caused quite a big slowdown
during mesh sync. Using a quick fix for now. Proper thing to do would be to
avoid most memory allocation in subd code.
This implements and packs OpenSubdiv's patch tables and patch maps into
Cycles own representation to allow the kernel to interpolate subdivided
attributes, which means generated coordinates are now correct for subdivided
meshes. Support for subdivided uv coordinates will be added once OpenSubdiv
has complete support for face varying interpolation.
Adds a descriptor for attributes that can easily be passed around and extended
to contain more data. Will be needed for attributes on subdivision meshes.
Subdivision options can now be set per object rather than per mesh. The
subsurface modifier must be the last in the stack or Cycles will ignore
the option.
This adds a WITH_CYCLES_OPENSUBDIV build option which will enable Catmull-Clark
subdivision meshes via OpenSubdiv. This option will be turned on automatically
if WITH_OPENSUBDIV has been turned on. Right now this option doesn't
actually do anything.
This renames most mentions of patches to subd faces, old way of naming was
confusing. Also start supporting ngons, which will be needed for proper
Catmull-Clark subdivision surfaces. Right now this is mostly just changing
how data is passed around, actual ngon support will come later.
The new __patches texture takes up a slot and goes past the limit on Fermi
cards which was causing the kernel to fail to build. To fix this there is now
one less image texture available.
Pack data for finding the originating patch of a triangle into unused bytes
in __tri_verts, __tri_vnormal and __tri_vindex. Since these bytes weren't
being used there's no increase in memory usage and we avoid more complicated
logic that would be necessary if this data was stored in attributes.
Reverting the geometry cache for now, there's still a lot of work to be done on
the other parts of the subdivision code and the added complexity of the cache
is slowing down development. Will add it back later after things are more
functional. For now this means scenes will potentially use much more memory, so
care should be taken when using the feature.
256 MB was a little small, and a larger cache will preform better. This will
probably change at some point in the future but for now its better to have a
larger default cache size.
This improves cache performance by reducing the maximum size of subpatches,
making tessellation both less likely to occur and faster. Difference in
performance is theoretically 100 times faster during thrashing as maximum
subpatch surface area is 100 time smaller, tho actual performance will vary.
This makes cycles subdivision code respect build options, disabling OSD code paths when desired. Since Catmull-Clark
subdivision requires OSD this subdivision type is unavailable with OSD disabled and linear subdivision will be used as a
fallback.
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.