Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix distortion in p5 integration #101

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

Merged
PWhiddy merged 1 commit into shader-park:main from davepagurek:fix/p5-distortion
Sep 5, 2023

Conversation

Copy link
Contributor

@davepagurek davepagurek commented Sep 5, 2023

Currently, cubes rendered via the p5 integration show spherical distortion:
image

This is because the p5 integration was inverting the model view matrix before drawing the sphere that we render Shader Park onto. However, when drawing a sphere, p5 updates the model view matrix again to apply a scale. The camera information passed to Shader Park does not have this scale, which results in incorrect rays.

I've updated the code to no longer do the matrix inversion in Javascript. This eliminates the need to grab the model view matrix ahead of time, and instead only uses the correct uMVMatrix that p5 passes in.

Updated:

image Live: https://editor.p5js.org/davepagurek/sketches/HM9sUI8Qh

PWhiddy reacted with heart emoji
Copy link
Member

PWhiddy commented Sep 5, 2023

Perfect thank you!

@PWhiddy PWhiddy merged commit b906491 into shader-park:main Sep 5, 2023
@davepagurek davepagurek deleted the fix/p5-distortion branch September 5, 2023 15:49
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Reviewers
No reviews
Assignees
No one assigned
Labels
None yet
Projects
None yet
Milestone
No milestone
Development

Successfully merging this pull request may close these issues.

AltStyle によって変換されたページ (->オリジナル) /