Triangle3d plugin

From the Asset Store
[C2] [C3] support C3 build service | support Banner ads, Interstitial ads, Rewared video ads.
  • Triangle3d plugin:

    dropbox.com/s/tkvqvc9aefi1jtk/triangle3d%20v0.81.zip

    To install, extract to: C:\Program Files\Construct 2\exporters\html5\plugins

    Requires: webgl

    Description:

    Basic 3d triangle plugin that lets you make triangles one vertex at a time. Each vertex has an xyz position, a uv texture coordinate and a rgba color. Every three vertices makes a triangle, and you can load textures to use on the triangles.

    That's about it for now. Think of it as a low level building block for 3d or 2d graphics.

    Basic usage:

    1. add to layout

    2. add an event like this:

    every tick
    -- triangle3d: set color to (1,0,0,1)
    -- triangle3d: add vertex ( 0, 0,0,0,0)
    -- triangle3d: add vertex (100, 0,0,1,0)
    -- triangle3d: add vertex (100,100,0,1,1)
    -- triangle3d: draw triangles with texture ""

    3. and you get a red triangle.

    Examples:

    basic:

    dropbox.com/s/wy4e76otnxqq9px/Tiangle3d_example_0.8.capx

    Change log:

    Version 0.81
    - changed how rotations are calculated.
    + Added an action and some expressions to get axis vectors from rotations.
    + camera transforms no longer wip. Added cameraZoffset expression to see the default camera z. It's based on the fov, and it's combined with the camera transform.
    + now renders at the resolution of the current canvas size.
    + orthographic camera now works.
    
    Version 0.8
    - changed how things worked a bit so examples from version 0.1 may not work.
    + added matrix transformations for camera and meshes.
    + camera is very wip right now though.
    + have use "draw triangles" or "draw mesh" to draw anything.
    + added obj file loader.
    + added save mesh to speed up repeated use of add vertex.
    ... probably more i forgot.
    
    version 0.1
    + vertexes with xyz position, uv texture coordinates, and rgba color.
    + Every three vertices draws a triangle utilizing a zbuffer.
    + Texture loading and selection with tagging to manage multiple textures.

    Current known limitations and planned additions for next version:

    Limit: won't work with layer/layout scaling currently. but you can fiddle with the camera scale to do it i think.
    Planned: texture unloading. and general garbage cleanup behind the scenes
    planned: maybe coloring of meshes.
  • Updated 5/15/21

    More useful for a 3d game. Still working out how to best handle the camera, but you can draw stuff with 3d rotations so that's cool.

    cheers

  • I will not probably use it, at least in the short time, but I really want to take the chance to thank you for all your effort to help the community.

    I don't usually use third party plugins, but I would definitely consider yours if I will be forced to use one.

    Thanks again :)

  • Try Construct 3

    Develop games in your browser. Powerful, performant & highly capable.

    Try Now Construct 3 users don't see these ads
  • thank you!

  • I love the plugin, it has helped me begin work on a 3D game I wanted to make a while ago. I only have a couple suggestions for it:

    Nearest neighbor sampling option for drawing 3D textures (in the case you want to make a 3D pixelated game)

    The ability to modify meshes, as in remove or add new triangles/vertices from an already existing mesh, OR the ability to save and load meshes in JSON format.

  • cool plugin

  • Very nice! Much appreciated.

    When I saw the per-vertex creation mode, I knew an .obj loader was either already in or on your mind...

    Feature-wise, I'd like to request:

    -ability to change texture filtering mode as grossrob0 suggested - at least unfiltered and bilinear would be great.

    -ability to either take textures from a Construct 2 Sprite or to have the ability for the Triangle3d object to hold images/Animations like a Sprite, with an additional option to load texture from URL (like the one available in the current version)

    -ability to have separate front/back textures for faces (for low-poly/stylized stuff)

    -mesh animation support, either via .obj sequences or moving vertices via the event sheet... I understand continuously loading .objs may have a performance impact...

    -support for .md3 (Quake 3 model format) - it's an old format, but there are exporters for modern DCCs for it, and it supports vertex animation.

    -basic per-tri raycasting support. if it's unfeasible, per bounding box will be good.

    Anyway, these are just my wishes - again, thank you for the plugin - even in its current version, it's a stable .obj loader with proper depth handling - for which I already have plenty of use.

  • Hi,

    Thanks for all the interest, and I’m glad it’s been useful. I ended up having to sideline further development for a bit. Life and stuff. Hope to get back to this eventually. Hopefully sooner than later.

    As to the requests:

    - Changing the texture filtering should be doable.

    - utilizing a sprites texture should be doable as well. Just have to take into account sprite sheeting.

    - I don’t have any immediate plans to allow adding/removing/modifying triangles from a mesh. Adding/modifying is a maybe. As is, I’d go with redoing the mesh from scratch per frame. I’m shooting with simple, easy to use and flexible. But I may change my mind after playing around with it.

    - I kind of like how the triangles are two sided, I can see how having single sided stuff allows for a texture on each side would be useful. May test later.

    - It would be nice to have some kind of animation like mesh deforms and skeleton skinning, but that would be a later feature as I’m not familiar with much of the various aspects of it. Currently, you can do stop motion style stuff with multiple object files. You’re only limited by memory there. Most any file format should be readable with varying degrees of difficulty. It’s the handling of that data that’s the most time consuming I think.

    - I have some ideas for collision detection and response. Ray casts would be nice too, but we’ll see how things go.

    My current tentative overall design would be:

    - Use tags for meshes, textures, and objects.

    - objects would be instead of the draw matrix. Instead you could specify as many objects as you liked. Each would have their own position, size, orientation and color. The you could change the mesh, and texture on the fly. While at it I’d like to make parenting too.

    The camera would treated as one of these objects so that would remove some redundancy.

    3D math within the event system gets busy looking fast so I’d like to add some more transformation features to simplify that. For example, rotate around an arbitrary axis, or moving at a 3D direction. We’ll see though.

    - rendering at least shadows from one light source would be cool too. It’s the type of thing that may be trickier than it seems. But as with everything else we shall see.

    Anyways. That’s the rough plan more or less.

  • That's a well-rounded feature set you have in mind.

    My 5 cents:

    -at least for my use cases, dynamically changing the triangle count in a mesh is not a high priority function - like you wrote, replacing the mesh source while keeping other visual properties the same achieves the same functionality.

    -for a simple animation system, I would suggest the way Element3d does it (an After Effects plugin) - it reads and plays back .obj sequences at a chosen rate - if it detects the same number of vertices between subsequent frames, it smoothly blends the transition. If not, it simply snaps to the next frame when the time comes.

    For something more advanced, reading a frame order sequence from a variable or Array would be great too - simple animation trees could be built with this.

    -for 3d math, I totally agree - parenting would be great, but then, ideally, shorthands for space translations would be needed (parent->world etc.), not to clutter the Event Sheet...

    -lighting/shadows would be great - I'm assuming some form of Shadow Mapping? I would suggest adding a hemisphere light like the one in three.js (https://threejs.org/docs/#api/en/lights/HemisphereLight) - it alternates between two colors based on surface normal orientation to the light object. Good for old-school, retro effects.

    I think that's it for my wall of text. Again, thank you for developing this.

Jump to:
Active Users
There are 1 visitors browsing this topic (0 users and 1 guests)