Open hypersurge opened 3 years ago
four points might not even lie on the same plane, how do you want to form quad out of them?
Are you familiar with mesh-shader approach in pixi? Its almost the same as in threejs.
https://pixijs.io/examples/#/mesh-and-shaders/triangle-color.js
Make your own geometry, shader and stuff.
Thanks. I am in manual control of the quad points, so don't need to worry (too much) about bends :)
Yes, I have already pursued the "roll-your-own" approach (extending mesh.Plane with vertices positioned based on projection matrices). It works fine, just no inbuilt frustrum and some perspective tearing. I can refine it further but wanted to first check I was not missing anything existing within this library.
extending mesh.Plane with vertices positioned based on projection matrices
plane doesnt have 3d points. no pixi mesh has 3d points.
extending mesh.Plane with vertices positioned based on projection matrices
plane doesnt have 3d points. no pixi mesh has 3d points.
For sure, the "3D" is being done outside of that class (with the resulting screen 2D being applied to the geometry vertices).
For sure, the "3D" is being done outside of that class (with the resulting screen 2D being applied to the geometry vertices).
and how do you think it will be able to transform texture UV's accordingly? Yes, by 4 points of quad its possible to reconstruct Z-coord that way texture is applied to a quad. That's what Sprite2d in this lib does.
You have to supply (x,y,z) points to your mesh anyway, whether its your calculated Z or something that was reconstructed
Oh, now i get it. you want to supply all X,y,z to vertexData2D :) Yeah, just override calculateVertices that way it doesnt re-write your changes and it'll be fine. The only thing is ..how will you apply sprite transform ot it? maybe you figure it out too. Basically, third coord there is not Z, its W. projective coord.
Exactly - that's what I'm looking at right now, overriding calculateVertices(). Thank you for the clarification I'm looking in the right place (and W vs Z) ... that's half the battle!
Yeah, all that stuff blew up my brain when i did it, i re-invented most of it )
I am attempting to create a 3D Quad where each of its corner points have directly controllable x,y,z. For example:
new Quad3d( Texture, Point, Point, Point, Point );
Within Sprite3d I see calculateVertices() which calculates each vertexData2d x,y,z based on world matrix, orig height & width, anchor. That is to say the underlying vertices are arranged rectangularly (without independent axis offsets or control). I am therefore uncertain if what I have in mind is viable.
@ivanpopelyshev What quick advice can you give please? Thank you.
Currently I have the equivalent working via workarounds ... calculating each corner position independently then drawing the resulting shape in "2D" space. This can be a bit slow, and doesn't benefit from the pixi-projection culling and frustrum routines.