-
Notifications
You must be signed in to change notification settings - Fork 233
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
Bgl replacement (and other 3.5 / 4.0 curiosities) #4983
Conversation
with minimal testing I think the branch runs both pre and post B3.5, without spitting errors. However there is a massive degrade in feature set for vdmk4.(and any of the derivatives).. namely: I like to think I kind of know what i'm doing in GL space, but the |
i'm not sure i'll be around to finish this PR, but here is one solution to the removal of the https://www.informit.com/articles/article.aspx?p=2120983&seqNum=2 according to this each Geometry Shader call will have a default variable called // Calculate two vectors in the plane of the input triangle
vec3 ab = gl_in[1].gl_Position.xyz - gl_in[0].gl_Position.xyz;
vec3 ac = gl_in[2].gl_Position.xyz - gl_in[0].gl_Position.xyz;
vec3 normal = normalize(cross(ab, ac)); and for (i = 0; i < gl_in.length(); i++)
{
gl_Position = gl_in[i].gl_Position;
EmitVertex();
}
//EmitPrimitive(); no need for this if you only emit one primitive
EndPrimitive(); here another intro https://computergraphics.stackexchange.com/questions/5086/how-can-i-offset-shrink-a-triangular-polygon-in-glsl and possibly mrdoob/three.js#5295 (comment) where instead of modifying the polygon geometry at "shadertime" , the suggestion seems to be to modify the vectors |
https://docs.blender.org/api/current/gpu.types.html#gpu.types.GPUShader here it does appear we can feed a geometry shader.
|
going down the geometry shader rabbit hole https://stackoverflow.com/questions/14909796/simple-pass-through-geometry-shader-with-normal-and-color this was useful.. Vertex Shader -> Geometry Shader -> Fragment Shader https://www.youtube.com/watch?v=C8FK9Xn1gUM I read somewhere that glsl on Metal doesn't support geometry shaders, not sure if that's true but that does mean a few issues for the codeflow. |
this branch doesn't work in the lastest 4.0 alphas @Durman |
i guess this technique fails when polygons are facing away from the viewer, therefore it would need to flip the normal in that case.
fragment_shader, has a built in variable if(gl_FrontFacing)
FragColor = ... ;
else
FragColor = ... ;
|
I guess it was renamed - https://docs.blender.org/api/4.0/bpy.types.NodeTreeInterfaceSocket.html#bpy.types.NodeTreeInterfaceSocket But it seems is not the only change, there is new attribute for setting tree interface - https://docs.blender.org/api/4.0/bpy.types.NodeTree.html#bpy.types.NodeTree.interface |
Hi @zeffii !
Now I can start this PR and it work now: Your work are very awaited !!! ))) |
satabol, OK. i have some time before christmas to spend on sverchok. will try to merge master into this PR and make a version that loads i feel OK about merging this soon-ish, as experimental for 4.0 - so people can at least use some of these "GL/BLF" viewers. i'll update the checklist at the top to reflect all that I think is still missing. |
How can we enforse or help with tasks? |
This branch does not yet reach feature parity, but i'm interested to see how it behaves in the wild. If anyone feels like merging this as is, I will be more likely to keep updating the 4.0+ parts (to solve the zfighting in solid/facetted/smooth modes) |
my primary goal was to get SV loading regardless of the Blender version, which it does seem to do now. Some graphical glitches (like zfighting edges/polygons) will occur in 4.0+ until a dedicated shader is implemented for 4.0+, but it needs to be executed only when edges and polygons are displayed at the same time) it's not a big task, I purely haven't sat at a computer for much of the past month. |
Weird. I probably didn't test on 3.6.. This is not good. |
Is this merged? |
when adding node in blender 4.1: works.
|
3.6: works |
cm remove
4b9ed84
to
90f9205
Compare
alternative bgl abstraction.
continuation of #4936
blf.text
to handle 3 vs 2 parametersessential nodes but
stethoscope
is pretty cool and if I get that to work then console node will also workautomatically (they share the same code)
Texture Viewer
nodes use some Gl code to place the texture in a state to receive data which i'm only tangentiallyfamiliar with :)
lines are not being obscured by polygons.
avoid z-fighting
( proof of concept: at the moment implements a normal shader in custom-shader mode )