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

3D Viewer Node crash the Blender 2.8 #1141

Closed
3DSinghVFX opened this issue Jul 10, 2019 · 12 comments

Comments

@3DSinghVFX
Copy link

commented Jul 10, 2019

Hi...
I have found that on the latest blender 2.8 builds, 3D Viewer Node crashes the Blender 2.8,
3DViewer1

Message in the crash file:
Screenshot from 2019-07-10 16-23-27

Blend File (Enable the auto execution to run the node-tree): 3DViewer1.blend.zip

@3DSinghVFX 3DSinghVFX changed the title 3D Viewer Node in a Group Node crash the Blender 3D Viewer Node crash the Blender 2.8 Jul 10, 2019

@OmarEmaraDev

This comment has been minimized.

Copy link
Collaborator

commented Jul 10, 2019

I can't replicate this. Does this happen whenever you use the Viewer node? Do you builds Blender yourself?

It seems like the source of the bug is in the Python C API ...

@3DSinghVFX

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

Omar, I have installed the fresh blender (build from official site), a fresh build of AN and still it is crashing. I have noticed that blender does not crash when there is no 3D Viewport but as soon as I open the 3D Viewport then blender crashes :(
blender.crash.txt

@3DSinghVFX

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

I tried to build blender few days ago but showed some error then I left it. Is it conflicting?

@3DSinghVFX

This comment has been minimized.

Copy link
Author

commented Jul 10, 2019

I have found that this problem occurs when I connect any Matrix Socket (e.g., Matrix distribute, Matrix Compose) to 3D Viewer Node.
3dview1

@OmarEmaraDev

This comment has been minimized.

Copy link
Collaborator

commented Jul 10, 2019

I can replicate this now. Thanks for the report! Will investigate.

@OmarEmaraDev

This comment has been minimized.

Copy link
Collaborator

commented Jul 10, 2019

Hey @3DSinghVFX , can you please execute the following in the text editor and tell me if Blender crashes? Thanks!

import bpy
import gpu
from gpu_extras.batch import batch_for_shader

vertex_shader = '''
    uniform mat4 viewProjectionMatrix;

    in vec3 position;
    out vec3 pos;

    void main()
    {
        pos = position * float(gl_VertexID) / 2.0;
        gl_Position = viewProjectionMatrix * vec4(position, 1.0f);
    }
'''

fragment_shader = '''
    in vec3 pos;

    void main()
    {
        gl_FragColor = vec4(pos, 1.0);
    }
'''

coords = [(1, 1, 1), (2, 0, 0), (-2, -1, 3)]
shader = gpu.types.GPUShader(vertex_shader, fragment_shader)
batch = batch_for_shader(shader, 'TRIS', {"position": coords})


def draw():
    shader.bind()
    matrix = bpy.context.region_data.perspective_matrix
    shader.uniform_float("viewProjectionMatrix", matrix)
    batch.draw(shader)


bpy.types.SpaceView3D.draw_handler_add(draw, (), 'WINDOW', 'POST_VIEW')
@3DSinghVFX

This comment has been minimized.

Copy link
Author

commented Jul 11, 2019

@OmarSquircleArt Yes, it crashes the Blender 2.8.

@JacquesLucke

This comment has been minimized.

Copy link
Owner

commented Jul 11, 2019

@OmarEmaraDev

This comment has been minimized.

Copy link
Collaborator

commented Jul 11, 2019

Can confirm that this commit fixes the problem. I also update the shader in 41b545a.

The patch didn't make it to the release candidate, so avoid drawing matrices for now. We will close this as soon as the patch makes it to master.

sobotka pushed a commit to sobotka/blender that referenced this issue Jul 15, 2019
Jeroen Bakker
Fix crash running GPU shader.format_calc() with attributes like gl_Ve…
…rtexID

When using opengl attributes such as gl_VertexID in a shader its
location is set to -1. This location was used without checking in an
attribute array. This fails big time when called from python. For
example `print(shader.format_calc())` made python crash immediately.

this fixes JacquesLucke/animation_nodes#1141

Reviewed By: fclem, brecht

Differential Revision: https://developer.blender.org/D5231
@3DSinghVFX

This comment has been minimized.

Copy link
Author

commented Jul 16, 2019

I have tested with the latest Blender build, AN is still crashing with 3D Viewer Node. I think the patch has not made it to the master branch.

@OmarEmaraDev

This comment has been minimized.

Copy link
Collaborator

commented Jul 16, 2019

Pretty sure it was commited to master, see B576963. I just build it from latest source and it worked. Maybe try with tomorrow's build.

@3DSinghVFX

This comment has been minimized.

Copy link
Author

commented Jul 16, 2019

Okay. I'll try it tomorrow :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants
You can’t perform that action at this time.