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

.obj models not displaying materials #7346

Open
1 of 17 tasks
bsack23 opened this issue Oct 31, 2024 · 6 comments
Open
1 of 17 tasks

.obj models not displaying materials #7346

bsack23 opened this issue Oct 31, 2024 · 6 comments

Comments

@bsack23
Copy link

bsack23 commented Oct 31, 2024

Most appropriate sub-area of p5.js?

  • Accessibility
  • Color
  • Core/Environment/Rendering
  • Data
  • DOM
  • Events
  • Image
  • IO
  • Math
  • Typography
  • Utilities
  • WebGL
  • Build process
  • Unit testing
  • Internationalization
  • Friendly errors
  • Other (specify if possible)

p5.js version

1.11.0

Web browser and version

130.0.6723.70

Operating system

mac os 14.7

Steps to reproduce this

Steps:

  1. load .obj file as model
  2. in draw() call normalMaterial() for example
  3. call model(yourModel)

Snippet:

let teapot;

function preload() {
 teapot = loadModel("teapot.obj"); 
}

function setup() {
  createCanvas(400, 400, WEBGL);
}

function draw() {
  background(20);
  normalMaterial();
  scale(50);
  translate(0, 1.5, 0);
  rotateX(PI);
  model(teapot);
}
@bsack23 bsack23 added the Bug label Oct 31, 2024
Copy link

welcome bot commented Oct 31, 2024

Welcome! 👋 Thanks for opening your first issue here! And to ensure the community is able to respond to your issue, please make sure to fill out the inputs in the issue forms. Thank you!

@iamnikhilranjan
Copy link

I’m interested in working on this issue. Could you please assign it to me ?

@davepagurek
Copy link
Contributor

Hmm I can't seem to reproduce this, it correctly uses normalMaterial for me here. Are you able to provide an example in the p5 editor showing the incorrect behaviour? https://editor.p5js.org/davepagurek/sketches/U7U1zG9HE

@iamnikhilranjan
Copy link

iamnikhilranjan commented Nov 6, 2024

Hi @davepagurek , please look at this :

Screenshot from 2024-11-06 20-15-14

https://editor.p5js.org/iamnikhilranjan/sketches/VS_AjO6FD

It seems loadStrings() is expecting a callback function as its third parameter but is instead receiving an empty variable, possibly due to a scope issue. I'm looking into the code to fix this rendering issue. Any guidance you could offer would be really helpful. Thank you!

@davepagurek
Copy link
Contributor

I believe that's a separate issue from the one described here, where we're trying to validate parameters on functions that are called internally by other p5 functions. We're going to address that separately using the technique described in the comments on #6597.

@davepagurek
Copy link
Contributor

@iamnikhilranjan I think your sketch isn't loading because the .obj file isn't present in the files for the sketch. Here's a zip of the one I was using to test with, you can try extracting the .obj from here and then uploading it to your sketch's files:
teapot.obj.zip

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

No branches or pull requests

3 participants