Skip to content

[F3D] Rewrite BSDF to F3D converter and add an F3D to BSDF converter#474

Open
Lilaa3 wants to merge 14 commits into
Fast-64:mainfrom
Lilaa3:f3d-to-bdsf
Open

[F3D] Rewrite BSDF to F3D converter and add an F3D to BSDF converter#474
Lilaa3 wants to merge 14 commits into
Fast-64:mainfrom
Lilaa3:f3d-to-bdsf

Conversation

@Lilaa3
Copy link
Copy Markdown
Collaborator

@Lilaa3 Lilaa3 commented Oct 26, 2024

Rewritten BSDF to F3D converter with support for picking up on which and how layers are used for merging them correctly in bad model imports, support for glTF2 styled color mul, picking up on uv gen, filtering, mapping, etc, if a material is lit, if a material is a cutout, transparent or opaque (even in 4.2) Brand new F3D to BSDF converter for outside fast64 context workflows where simple materials are desired. I mainly targeted glTF and obj compatible models. The new implementations should also make non sm64 people pretty happy aha! Code may need some clean up, I'll consider undrafting tomorrow morning but all the features and bugs should be review ready.. hopefully

Lilaa3 and others added 4 commits October 26, 2024 22:43
Rewritten BSDF to F3D converter with support for picking up on which and how layers are used for merging them correctly in bad model imports, support for glTF2 styled color mul, picking up on uv gen, filtering, mapping, etc, if a material is lit, if a material is a cutout, transparent or opaque (even in 4.2)
Brand new F3D to BSDF converter for outside fast64 context workflows where simple materials are desired. I mainly targeted glTF and obj compatible models.
The new implementations should also make non sm64 people pretty happy aha!
Code may need some clean up, I'll consider undrafting tomorrow morning but all the features and bugs should be review ready.. hopefully
@Lilaa3 Lilaa3 marked this pull request as ready for review October 27, 2024 13:27
@ariahiro64
Copy link
Copy Markdown

mirror doesnt work i was wrong

@ariahiro64
Copy link
Copy Markdown

seems stable on supported blender versions.

Copy link
Copy Markdown

@ariahiro64 ariahiro64 left a comment

Choose a reason for hiding this comment

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

doesnt support every feature but is way better of a situation

@ariahirose64
Copy link
Copy Markdown

lost access to above account so cant rereview with good faith

@Lilaa3
Copy link
Copy Markdown
Collaborator Author

Lilaa3 commented Apr 15, 2025

doesnt support every feature but is way better of a situation

what features are missing when compared to obj and glTF (main export targets for this)

@Lilaa3 Lilaa3 added enhancement New feature or request review code please Ask that some other Fast64 dev reviews the code f3d Has to do with the "f3d" code common to all games labels Apr 15, 2025
@Dragorn421
Copy link
Copy Markdown
Contributor

I just merged main into this branch, hopefully correctly

@ariahirose64
Copy link
Copy Markdown

ariahirose64 commented Jun 27, 2025

logged in as i think i owe you this, as of now a merge and a warning is enough if it keeps getting worked on in steps
below is the 2 things that should be noted

Details

image

@ariahirose64
Copy link
Copy Markdown

ariahirose64 commented Jun 27, 2025

was using the force push 11 hours ago btw, and these 2 issues are very minor.

@Lilaa3
Copy link
Copy Markdown
Collaborator Author

Lilaa3 commented Jun 27, 2025

Well I'm mostly focusing on gLTF and obj, I know glTF supports mirror, tho I'll have to check docs, but the tex gen? Yeah idk what to do with that

@ariahirose64
Copy link
Copy Markdown

ariahirose64 commented Jun 27, 2025

Well I'm mostly focusing on gLTF and obj, I know glTF supports mirror, tho I'll have to check docs, but the tex gen? Yeah idk what to do with that

should be a mapping coordinate that exposes scaling. i did that for my pc game during the transition.
(wrote wrote my own shader as well as i can just plug n64 like setting directly into unity but still)

Copy link
Copy Markdown
Contributor

@Dragorn421 Dragorn421 left a comment

Choose a reason for hiding this comment

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

issue 1

is it intended that the "backup" also uses bsdf materials after converting from f3d to bsdf, instead of the original f3d materials
image

issue 2

I get the following error when converting from bsdf to f3d, after initially converting from f3d to bsdf:

Converting BSDF materials in gBoulderFragmentsDL_mesh.001
Converting BSDF material f3dlite_material.001_bsdf
Traceback (most recent call last):
  File "/home/dragorn421/.config/blender/4.2/scripts/addons/fast64/fast64_internal/operators.py", line 72, in execute
    self.execute_operator(context)
  File "/home/dragorn421/.config/blender/4.2/scripts/addons/fast64/fast64_internal/f3d/bsdf_converter/operators.py", line 200, in execute_operator
    raise exc
  File "/home/dragorn421/.config/blender/4.2/scripts/addons/fast64/fast64_internal/f3d/bsdf_converter/operators.py", line 131, in execute_operator
    converted_something |= obj_to_f3d(
                           ^^^^^^^^^^^
  File "/home/dragorn421/.config/blender/4.2/scripts/addons/fast64/fast64_internal/f3d/bsdf_converter/converter.py", line 428, in obj_to_f3d
    col_layer = get_layer_and_convert(abstracted_mat.vertex_color)
                ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/home/dragorn421/.config/blender/4.2/scripts/addons/fast64/fast64_internal/f3d/bsdf_converter/converter.py", line 407, in get_layer_and_convert
    return obj.data.vertex_colors[layer_name]  # HACK: layer cannot be trusted
           ~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^^^^^
KeyError: 'bpy_prop_collection[key]: key "Col" not found'

suggestion

automatically set bsdf shader "roughness" parameter to 1 so it doesn't look glossy/shiny by default

issue 3

more complicated test, kakariko village from oot
some grass floor is much darker than should be for some reason
image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request f3d Has to do with the "f3d" code common to all games review code please Ask that some other Fast64 dev reviews the code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants