[feature] Cartoon shader improvements
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
Panda3D |
New
|
Undecided
|
Unassigned |
Bug Description
As described on the forum:
http://
attached is a patch containing some new features for the cartoon shader, hereby submitted for code review. The patch has been tested against Panda3D 1.8.1.
Changelog:
- Smoothed light/dark boundaries in light ramping. In addition to sharp thresholding as previously, a linearly interpolated transition is now supported in both single and double threshold modes. The length of the interpolation range can be adjusted (separately for both transitions in double threshold mode). This exploits the continuity of lighting values on smooth surfaces, and is not the proper way to antialias the boundaries under arbitrary circumstances, but in practice it seems to give satisfactory results.
- Light ramping now optionally affects the specular lighting contribution, too. The threshold/
- An "advanced ink" filter has been added to CommonFilters.py. It is based on the existing inker, but it has some new features. It accounts for the distance of each pixel from the camera (nearer = larger separation parameter -> thicker line), smooths the lines using a blur filter, and optionally the inking can be rendered into a double-sized buffer to reduce artifacts at nearly horizontal or vertical edges.
- The "cutoff" parameter of Tut-Cartoon-
Additionally, this patch contains fixes to #1214782 and #1219422. (Separate patches fixing only those bugs are available in the respective bug reports.)
- Fixed the double threshold light ramp ( https:/
- Fixed a shader generator error with some material property combinations ( https:/
New version of patch.
- added a helper function to always allocate consecutive TEXCOORD registers, regardless of which combination of filters is enabled
- removed double resolution inking (from first patch), as it was basically useless
- added docstrings to setXXX() functions, documenting most of them. (This should probably be moved into its own patch.)