LennardF1989's Forum Posts

  • 6 posts
  • I currently have implemented it with minimal changes to the engine (layout.js and glwrap.js) - literally 10 lines of code combined. I can now define a layer, call it "sampler<something>" (eg. samplerDepth) and set "Force own texture" to true.

    This combination makes my code kick in, it bypasses the usual force own texture (keeping this.render_offscreen at false) and creates one in the runtime instead (this.runtime[this.name] rather than this.runtime.layer_tex). With a slight change in the glwrap.js, it then binds a texture based on a parameter name.

    With that I have successfully created rendertargets with minimal overhead.

    In the screenshots, I implemented a depthbuffer. The red block means obstacle, so my shader will pick that up and not render light on it in the final in-game picture.

    In-editor:

    <img src="https://dl.dropboxusercontent.com/u/4832900/Construct%202/In-editor.png" border="0" />

    In-game:

    <img src="https://dl.dropboxusercontent.com/u/4832900/Construct%202/In-game.png" border="0" />

    This is also very useful for normal mapping and specular mapping, as you can now query multiple layers for information (pretty much like a GBuffer in a deferred renderer).

  • So I dove into the javascript code of Construct a little and it seems its very doable to expose functions to create and modify render targets by means of a plugin.

    I think I'm going to pursue it as I think it can bring Construct 2 - in terms of making WebGL games - to a new level of usability.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • Yes, I saw that as I was digging through layout.js and glwrap.js. This will probably get me a bit closer to what I want to achieve. However, I imagine this still doesn't allow me to access layer 0 from an effect on layer 4, right (when they have their own texture forced, obviously)?

    My idea is to have an instance with a Light effect attached to it (metadata like color, radius, etc), which in turn affects an effect on a layer to render the actual effect, but for that I need access to all render targets I desire.

    Also, mobile is not an issue for me right now. I'm looking into the possibilities of Construct for a commercial PC game ;) I could go ahead and write Yet Another 2D engine in some language for my game, but I'd like to give Construct a shot as I can give a lot of the development out of my hands with ease.

  • Construct 2 is an awesome toolset and I have been experimenting a little by adding deferred lightning and shadows by means of an effect.

    I managed to get a single light working, however, what I'm really missing to unleash its full potential is access to samplers other than the back and front.

    Preferably, I would like access to individual layers. When a layer is flagged as such, it basically becomes a render target. What this allows me to do is setup layers as a normalmap/depthmap from which I can query information.

    For example: when I want to stop the light from casting through a wall, I need to know where a wall is in the shader. A depthmap could give me that information.

    Screenshot:

    <img src="https://dl.dropboxusercontent.com/u/4832900/Construct%202/screenshot.png" border="0" />

  • LennardF1989

    Did you somehow miss Ashley's response? The SDK is perhaps your best bet.Her response is the reason as to why I am bumping a topic from 2012: The SDK doesn't support it.

    Hence I am asking her to reconsider and expose edit-time drawing functions to Behaviours for debugging purposes, my example being one way to apply it.

  • I actually would like to bump this, being able to draw stuff on top of objects using Behaviours would be extremely useful for debugging purposes.

    For example, I have a few objects which are linked together and I would like to draw a physical line between them. That way I can immediately spot if objects are still correctly linked.

  • 6 posts