-
Notifications
You must be signed in to change notification settings - Fork 23
GL_INVALID_FRAMEBUFFER_OPERATION when trying to add bloom effect #78
Comments
My understanding is that ngt-primitive is used to wrap an underly THREE object3d. Have you tried loading into ngt-mesh or ngt-group instead of ngt-primitive? This Example shows using ngt-mesh |
Thank you IRobot1. Do you mean to wrap the primitive inside a ngt-group? If so, that does not work. |
No. I was suggesting something like this if queen was a single mesh <ngt-mesh
(animateReady)="onAnimate($event.object)"
(ready)="queenLoaded($event)"
*ngIf="queen | async as queen"
[geometry]="queen.geometry"
[material]="queen.material">
</ngt-mesh> Can you share 'assets/threed/queen.glb'? I've confirmed that using the following code in a different scene, does not result in the warnings you reported. <ngt-effect-composer>
<ngt-bloom></ngt-bloom>
</ngt-effect-composer> |
Hi IRobot, thank you for your help. I have uploaded |
Hi all, I've been pretty busy at work and some personal life stuffs. AngularThree is still being maintained but it's a little slow for now. Thank you. |
Hi Nartc, it happens to the best of us. Hope you get time to give NGT some love soon. Again, thanks for this great library. |
Hi @IRobot1, @nartc to test out the solution suggested by IRobot1 I need to figure out how to bind the Any help is much appreciated. Also, wondering if this is the correct way to assign these properties in my
|
@99js if you try to console log the data of public queen = this._ngtGLTFLoader.load('assets/threed/queen.glb).pipe(
tap(data => {
console.log(data); // <-- check here
})
) |
@nartc Thank you. After a few tries, I was able to create the same example using NGT group and mesh. I created a new MeshStandardMaterial and used the geometry from my Blender object. Everything works fine, except the bloom effect is still throwing the same warnings and is not working from a performance perspective. Would it be worth trying to create the bloom effect in Blender and try to include it as a new mesh in the NGT group somehow? I started learning everything about 3D just the other day and have never worked on this before so please excuse my ignorance. |
You were pretty close. The following code runs without the warnings and animated the model <div style="height:100vh">
<ngt-canvas>
<ngt-spot-light [position]="[50, 50, 50]"></ngt-spot-light>
<ngt-spot-light [position]="[-50, -50, -50]"></ngt-spot-light>
<ngt-directional-light [position]="[0, 1, 2]"
color="white"></ngt-directional-light>
<ngt-mesh *ngIf="mesh" (animateReady)="onAnimate($event.object)"
[material]="mesh.material"
[geometry]="mesh.geometry">
</ngt-mesh>
<ngt-soba-orbit-controls #controls="ngtSobaOrbitControls"
(ready)="setInitial(controls)"
[target]="[0, 0, 0]">
</ngt-soba-orbit-controls>
<ngt-effect-composer>
<ngt-bloom></ngt-bloom>
</ngt-effect-composer>
</ngt-canvas>
</div> import {
Component,
Input,
} from '@angular/core';
import { NgtVector3 } from '@angular-three/core';
import { NgtGLTFLoader } from '@angular-three/soba/loaders'
import { NgtSobaOrbitControls } from '@angular-three/soba/controls';
import { Mesh, MeshStandardMaterial, PerspectiveCamera } from 'three';
@Component({
selector: 'queen',
templateUrl: './queen.component.html',
})
export class QueenComponent {
@Input() public position?: NgtVector3; // imported from @angular-three/core
public hover = false;
public active = false;
public queenMaterial: MeshStandardMaterial | undefined;
#color = '#5323ff';
public mesh!: Mesh;
constructor(private _ngtGLTFLoader: NgtGLTFLoader) {
const s = this._ngtGLTFLoader.load('assets/queen.glb').subscribe(next => {
const mesh = <Mesh>next.scene.children[0];
this.mesh = mesh;
(<MeshStandardMaterial>this.mesh.material).color.setHex(parseInt(this.#color.substring(1), 16))
},
() => { },
() => { s.unsubscribe(); }
);
}
setInitial(controls: NgtSobaOrbitControls) {
const orbitControl = controls.controls;
const camera = orbitControl.object as PerspectiveCamera;
camera.zoom = 2;
camera.position.setX(0);
camera.position.setY(50);
camera.position.setZ(200);
}
onAnimate(mesh: THREE.Object3D) {
mesh.rotation.y = mesh.rotation.x += 0.01;
}
} |
Thanks a lot, @IRobot1It looks somewhat similar to what I did but clearly I'm still missing something. I'll go over your code to see what the issue might be. This is what I did (queen has been replaced by knight and don't mind the terrible code formatting):
|
@IRobot1 I ran your code, but I still get the same warnings. Being new to Angular I do not know all the features and configurations, but I wonder if there might be some configuration issues on my local. |
Could be. Can you share your github repo? Perhaps you can give me temporary access. I occassionally forget to include a module in the app that results in warnings or failures only at runtime. I would start by checking that. ng3 is very modular and requires a lot of modules to be imported so its easy to miss one. Most are caught at compile time, but some fail at runtime with not very obvious errors. |
Thanks a lot for your help @IRobot1 ! I have created a private repository and made you a collaborator. The project includes all the packages from the original project. Let me know if you are facing problems accessing the repository. |
Thanks. I have access and can repeat your warnings. I'll start investigation. |
It has something to do with putting ng3 in your website module. When I remove the website module and route and reference the queen directly from app.module, it works without warnings. |
If I replace lazy loading, export the landing page and reference the landing page directly, the warnings come back and nothing is displayed. const routes: Routes = [
{
path: '', component: LandingPageComponent,
// loadChildren: () =>
// import('./modules/website/website.module').then((m) => m.WebsiteModule),
}
];
@NgModule({
imports: [RouterModule.forRoot(routes)],
exports: [RouterModule],
})
export class AppRoutingModule {} At the moment, my recommendation is to avoid using modules and put all your ng3 components in the main app module. That's a pain, but seems to be the only solution at the moment. |
I'll publish a repeat case so that @nartc can investigate. Without this getting fixed, it won't be possible for anyone to publish reusable libraries that includes ng3. |
A simpler repeat case is not showing the same problem. Now, I'm stumped why its failing in your project. I'll keep looking. |
@nartc I have a repeat case now on 2 different branches of a simple template project. Clone to review postprocessing branch is just an app. When ng3/postprocessing is added, it works as expected. route+module+postprocessing branch demonstrates the warnings as originally reported by @99js |
I have another branch where lazy loading is removed. The test component is referenced directly from the main app route. The warnings still appear, however, there are fewer of them. This makes be think its related to loading modules from a route. So the underly problem appears to be when using routes+modules. I confirmed using post processing from a module directly has no warnings |
Thank you very much @IRobot1. I'll be honest and say that I am new to programming and learnt the basics of Github just the other day. What you did with creating a repository and different branches for different cases is something I can do to contribute to the Ng3 in the future. However, at the moment, as I am learning both Javascript, Angular and Ng3 at the same time, trying to fix these issues on my own is a bit over my head I'm afraid. Maybe in the coming months or so I will have gotten enough understanding to do it myself and contribute to the repository in a more tangible way. In the meantime, I am very thankful for yours and @nartc help. As you say, being able to create reusable Ng3 components is a must feature as having everything in the App root is untenable. |
@99js That's a steep learning curve. That's how I felt 5 years ago when I started Angular development. There's honestly a lot I still don't know. I still struggle to decipher the code @nartc is writing. I have a branch showing that having re-usable components in a module does work, just not when accessed from a route. |
@IRobot1 I started my journey with Javascript and Angular in January this year indeed it has been a really steep learning curve. But I am happy that I am starting to get the basics down but still have a mountain to climb. |
I've seen this as well but not sure how to fix it. If I put a long enough delay (500ms) on the EffectComposer's render, then the error's gone. So there must be some racing condition somewhere but I can't tell what it is because I don't know what generates the INVALID warnings :( |
Getting hundreds of the following two warnings and a huge performance drop when trying to add bloom effect with
ng-effect-composer
. The bloom effect never takes effect.I have tried with different objects but got the same warning.
I have a
queen
component holding a primitive object below which I am trying to display on alanding-page.html
.queen.component.ts
queen.component.html
landing-page.html
<queen></queen>
The text was updated successfully, but these errors were encountered: