Skip to content
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

Shaded wireframes. #41049

Closed
wants to merge 1 commit into from
Closed

Shaded wireframes. #41049

wants to merge 1 commit into from

Conversation

fire
Copy link
Member

@fire fire commented Aug 5, 2020

Fixes godotengine/godot-proposals#1000

  • Make a view menu option.
  • Fix rendering flickering problem
  • Grow the wireframe

This renders twice.

HELP! Need to understand why it's flickering.

Alternative implementation is using geometry? compute? shaders and https://github.com/XRTK/XRTK-Core/blob/8bd7559136374f6d6ae804d9e311a4d60ae0ae6c/XRTK-Core/Packages/com.xrtk.core/Runtime/StandardAssets/Shaders/XRTK_Wireframe.shader

@fire fire marked this pull request as draft August 5, 2020 13:05
@Calinou
Copy link
Member

Calinou commented Aug 5, 2020

HELP! Need to understand why it's flickering.

Maybe it's Z-fighting with the geometry behind the wireframe? I'm not sure how other rendering engines handle this.

Looking at how Red Eclipse renders outlines, it seems to be using parts of OpenGL dedicated to polygon offset.

Polygon offset enabled (default)

Red Eclipse screenshot

Polygon offset disabled

Red Eclipse screenshot

@fire fire force-pushed the wireframe-master branch 3 times, most recently from d8dc724 to f1c2453 Compare August 5, 2020 13:28
@Zireael07
Copy link
Contributor

Maybe make the wireframe be a second pass that uses a small grow effect (grow as in what the SpatialMaterial does, not too sure of the shader equivalent)?

Most likely it's Z-fighting indeed.

@fire
Copy link
Member Author

fire commented Aug 5, 2020

image

@fire
Copy link
Member Author

fire commented Aug 5, 2020

Grow looks like:

		wireframe_material_shader = storage->shader_create();
		storage->shader_set_code(wireframe_material_shader, "shader_type spatial;\nrender_mode wireframe,unshaded;\n void fragment() { VERTEX+=NORMAL*Vector3(0.01,0.01,0.01);ALBEDO=vec3(0.0,0.0,0.0); }");
		wireframe_material = storage->material_create();
		storage->material_set_shader(wireframe_material, wireframe_material_shader);

@fire
Copy link
Member Author

fire commented Aug 5, 2020

The flickering is very weird. It seems to be toggling modes when close to the mesh.

GIF 2020-08-05 6-32-01 AM

@fire fire force-pushed the wireframe-master branch from f1c2453 to b408830 Compare August 5, 2020 13:36
@fire
Copy link
Member Author

fire commented Dec 23, 2020

This pr is salvagable. However, I am not working on it.

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

Successfully merging this pull request may close these issues.

Add an outline mode to the editor 3D viewport rendering modes to complement the wireframe mode
4 participants