Frag Light experimental now works C3 Objects (constrained)



This is pretty experimental, but it adds support for a project which patches the C3 runtime to enable per fragment lighting for 3DObject.

The project is included here.

Currently only works with non-worker animation mode (if it proves promising, will add worker mode)

Look at main.js for some info on how to add and change lights (color, position, spotlight, direction, etc.)

The position of a light can be controlled, but they will all use the same offset for the control.

*NOW* C3 Objects will also be lit. However, if you apply any effects to do them or change color, opacity, the lighting will be removed and the effect may not work (you may be able to stack effects though and the first effect may not work, but following ones may, please experiment and report back results!)

Effects will work on 3DObject and 3DShape.

Pure HTML elements will render on top as before (e.g. button, input box)

Try it out! If you do changes to the project (js, etc.) please share, let's work on this together).

Files

3DObjectFragLight-2-60-0.c3p 3.2 MB
Feb 09, 2024
3DObject-2-60-0.c3addon 113 kB
Feb 09, 2024

Get Construct 3 3DObject Plugin

Download NowName your own price

Comments

Log in with itch.io to leave a comment.

where I can get the Outline Glow addon?

(2 edits) (+1)

I added it to this itch page.

ayee! thank you!

This is cool! I think its broken when I turn on worker animations though.

Nevermind you said it up there, didnt read.

Will get that working if people really need it (if we can use this beyond just experimentation, we need another way to implement it, so it's easier to control the lights  during runtime.)

For me, I would've already used as it is now since I only use 1 light to light up the whole scene. It makes my ugly textures and models look way better. The only thing that's stopping me is I need worker animation because half of my models use it and it would lag without it. I haven't encountered any bugs or anything yet when exported, when workers and webgpu are off. Controlling the position and colors would be cool for something like DAY/NIGHT cycle. I'm using toonshader and oilpaint effects for 3dobject floor and it looks and works great. I want to create a graphics demo scene later for a looks test. Will upload when finished.

Well that sounds like a good reason! I will add it sometime next week.

Hi Kindeyegames , I was just checking out performance of the Old Q3d plugin in Construct 2 and I was surprised to see that even with better high fidelity model, animation, lightening, shadow its performance was higher than 3d object plugin for construct 3. Is it due to three.js used in that plugin? Is there a way to improve performance in this plugin in future?

I found this developer who uses Q3d plugin and the performance are visuals are suprisingly impressive: UNDISPUTED MMA by Osayuware (itch.io)

That is due to the difference between using the C3 renderer (the runtime C3 engine for rendering Quad3D) and using a separate dedicated 3d engine (three.js or other), there are pros and cons with both. Obvious pros for separate engine are performance and features. Pros for using C3 engine is better integration with C3 other behaviors, effects and rendering order for integration with other C3 objects, like sprites, etc. (sometimes the custom engines will render on top of or behind the normal C3 render canvas).

I made the choice to try to integrate with the C3 engine as much as possible, to make it like a regular C3 addon.

I think the other options are really interesting and definitely worth exploring as a dev. If you only want to use 3D from the custom engine and it has also the ACEs you need it could be a great way to go.

This is really great. Can't wait for this to be in a stable state, as I am currently struggling to make 3d graphics look good with only flat colors in my game. This and shadow mapping are the only thing missing. Wish we had more people knowledgeable in 3d willing to help out now that its all open source.

I am definitely open to PRs, the main function of frag lighting is outside the addon, the addon is just setting a flag for the hacked vertex shader in the lighting case. Shadow map would also probably be a little outside the addon, and typically requires multiple renders, 1 per light to create shadow map. Something C3 is not really setup for.

Instead would look at baking shadow maps and applying to geometry and use an old technique like this to roughly apply it to moving actors: https://www.reddit.com/r/Unity3D/s/jEOZBCfUSC

Have not tried it myself, but seems plausible.

That's actually a pretty smart trick.

got tired of waiting and just hacked it in lol. should be the new meta. all we need is a cool test game so scirra can see the possibilities. the performance is also wild. i was  expecting to use like 80% gpu for some reason lmao.

I'll play with this this weekend thanks! This needs outline glow btw.