Skip to content

Real v5 cel shading#5

Open
sauraen wants to merge 24 commits into
thecozies:V5from
sauraen:RealV5CelShading
Open

Real v5 cel shading#5
sauraen wants to merge 24 commits into
thecozies:V5from
sauraen:RealV5CelShading

Conversation

@sauraen
Copy link
Copy Markdown

@sauraen sauraen commented Jul 28, 2022

Cel shading has been translated to fast-64/V5 (formatting only) and then to thecozies/V5 (actual V5).

Lighten/darken mode has been removed and replaced with "fixed" mode, where a tint level and tint color is set in the DL, or "segment" mode, where a segment contains (possibly) multiple tint settings like:

gsDPSetPrimColor(0, 0, lightTintColorR, lightTintColorG, lightTintColorB, lightTintLevel),
gsSPEndDisplayList(),
gsDPSetPrimColor(0, 0, darkTintColorR, darkTintColorG, darkTintColorB, darkTintLevel),
gsSPEndDisplayList(),

enabling the tint colors and levels to be set dynamically from actor code to reflect nearby lighting conditions.

There is no previewing of any of this; what is shown in the GUI is the material without any tint. It will take noticeable changes to the nodes to support previewing this.

@sauraen sauraen changed the title WIP: Real v5 cel shading Real v5 cel shading Jul 30, 2022
Comment on lines +163 to +164
if bpy.context.scene.celShadingPatch:
data.source += '#define G_CELSHADING 0x00400000\n\n'
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the microcode patch should probably have this defined in gbi.h, or else there could be a risk of getting a bunch of redefinition errors

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

gbi.h is provided by z64hdr in the case of Triforce%, so it's not possible to be changed in that project. Perhaps in a decomp-based toolchain people will be willing to edit their own gbi.h when they apply the microcode change as well. However, please keep in mind that redefining a macro to the exact same thing as it was already defined to is not an error, it's silently ignored by the preprocessor.

Comment thread fast64_internal/f3d/f3d_writer.py Outdated

return fMaterial, texDimensions

def getCelShadingInfo(material):
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

to me it seems like CelShadingInfo is used enough where it could warrant some type of class or definition, as well as the levels. then we can add type annotations everywhere and keep things in sync easier

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Agreed, I'll add that.

triGroup,
existingVertexData,
existingVertexMaterialRegions,
celShadingInfo
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if you create a CelShadingInfo class this would be a great place for a type annotation

Copy link
Copy Markdown
Owner

@thecozies thecozies left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

looks pretty good so far, i have a few suggestions for documentation but i think the implementation should work well. i'll need to test sm64 exports with this and regression test. one concern of mine is making sure that the user's presets are retained

sauraen and others added 13 commits July 30, 2022 15:15
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
Co-authored-by: thecozies <79979276+thecozies@users.noreply.github.com>
* Fixed incorrect CI textures on import for OOT.

Fixed bug where CI textures would be corrupted when importing OOT display lists.

* Minor name changes/tweaks.

* Added more informative comments, formatted with black
…Fast-64#135)

* Fixed operator data_type argument for blender 3.3

* Switched to API instead of using operators
* Black format files touched by texture saving PR

* Black format files touched by flipbook PR
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants