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

Error of shape optimization #901

Open
kaktus089123 opened this issue Jan 8, 2025 · 2 comments
Open

Error of shape optimization #901

kaktus089123 opened this issue Jan 8, 2025 · 2 comments
Labels
bug Something isn't working

Comments

@kaktus089123
Copy link

Most appropriate sub-area of Processing 4?

Core/Environment/Rendering, OpenGL, Export

Processing version

5/4.3.1/3.5.4

Operating system

Windows/Android

Steps to reproduce this

"1.Use alpha in color of fill(). It start can be visible.

2.3D primitives or obj models."

snippet

// Paste your code below :)

void setup() {
fullScreen(P3D);
}

void draw() {
background(0);
rotateY(PI/180*frameCount);
fill(255,50);
box(100);
//or obj model
}

Additional context

Fix it in p3 and p4 please. I making programs for old windows and android versions. And in p4 doesn't load and save files in play mode and released app.

@kaktus089123 kaktus089123 added the bug Something isn't working label Jan 8, 2025
@hx2A
Copy link
Collaborator

hx2A commented Jan 9, 2025

I tried running the code to see if I could understand what is happening here. When the cube has a partial transparency, there are inconsistencies in how the cube looks as it rotates around. Here are two screenshots:

image

image

For every 90 degree rotation, the cube faces should have identical colors. Based on the position of the cube in the above two images, they should look the same. @kaktus089123 , is this the problem you are observing?

I've worked closely with the cube() code before and remember suspecting there was a bug. Let me check my notes and see if it is relevant to this issue.

@hx2A
Copy link
Collaborator

hx2A commented Jan 9, 2025

I looked at this closer and realized I need to add a rendering hint so that the partially transparent box is rendered correctly.

void setup() {
  size(500, 500, P3D);
  hint(DISABLE_DEPTH_MASK);  // <- add this line
}

void draw() {
  background(0);
  translate(250, 250);
  rotateY(PI/180*frameCount);
  fill(255, 50);
  box(100);
}

You can read more about hint() in the reference docs.

Using that hint is important when there are partially transparent objects.

@kaktus089123 , does this address your issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants