-
Notifications
You must be signed in to change notification settings - Fork 6
Added subtractive workflow #19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
coen22
wants to merge
22
commits into
RadicalCSG:main
Choose a base branch
from
coen22:main
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
22 commits
Select commit
Hold shift + click to select a range
6affd23
fix: ignore invalid editor resource paths
coen22 4d94b61
Ignore resource paths outside project
coen22 445c313
Merge pull request #1 from coen22/codex/fix-invalid-assetdatabase-paths
coen22 eccb27f
Add subtractive editing option to model
coen22 7e6b500
Updated mats version
ed88df3
Fix default operation model variable
coen22 1472931
Fix variable scope in placement tool cases
coen22 bd1fcaf
Add subtractive mode behavior
coen22 2f39c96
Implement subtractive editing by flipping normals
coen22 272eea1
Flip meshes when SubtractiveEditing toggled
coen22 246460d
Merge pull request #2 from coen22/codex/add-subtractive-editing-prope…
coen22 42d903f
Update README.md
coen22 4adf9a3
Update Wall.mat
6923008
Add normal smoothing support
coen22 6fa306e
Fix normal smoothing using custom NormalSolver
coen22 455869b
Update NormalSolver.cs
7e7c6ef
Update README.md
f21370c
Merge pull request #5 from coen22/codex/add-normal-smoothing-to-model…
coen22 6f42085
Move debug settings to dedicated inspector section
coen22 b32605e
Merge pull request #9 from coen22/vjpp8u-codex/add-debug-section-to-c…
coen22 6d6430b
Add DebugLogOutput option and logging
coen22 08aafca
Merge pull request #13 from coen22/p8m027-codex/add-debug-log-for-ver…
coen22 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,36 @@ | ||
using System; | ||
using UnityEngine; | ||
|
||
namespace Chisel.Components | ||
{ | ||
internal static class ChiselMeshUtility | ||
{ | ||
public static void FlipNormals(Mesh mesh) | ||
{ | ||
if (!mesh) | ||
return; | ||
|
||
var normals = mesh.normals; | ||
if (normals != null && normals.Length > 0) | ||
{ | ||
for (int i = 0; i < normals.Length; i++) | ||
normals[i] = -normals[i]; | ||
mesh.normals = normals; | ||
} | ||
|
||
for (int s = 0; s < mesh.subMeshCount; s++) | ||
{ | ||
var indices = mesh.GetTriangles(s); | ||
Array.Reverse(indices); | ||
mesh.SetTriangles(indices, s); | ||
} | ||
} | ||
|
||
public static void SmoothNormals(Mesh mesh, float angle) | ||
{ | ||
if (!mesh) | ||
return; | ||
NormalSolver.RecalculateNormals(mesh, angle); | ||
} | ||
} | ||
} |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to do the surface flipping / normal smoothing in GenerateSurfaceTrianglesJob
Right before where ComputeTangents / ComputeUVs is performed, Since calculating a correct tangent is dependent on the normal
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, I think I'll close this PR and I'll create a new one where I make this more clean. But the principles work. So that's good.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
cool :)