Prominent's Forum Posts

  • Seems pretty simple. I think it needs more challenges/game elements for it to have more replay value. At the moment once you play a few stages, it begins to feel repetitive.

  • Here is a visual example of the problem:

    http://stackoverflow.com/questions/1624 ... ture-alpha

  • I'm trying to get shadows casting from models with alpha transparency.

    I found this:

    http://threejs.org/examples/webgl_animation_cloth.html

    Which does what I'm trying to do, but I'm trying to figure out a way to apply this effect in Q3D..

    I've looked at the qfxloader and I've made this file:

    <shadertype>ShaderMaterial</shadertype>
    <vertexshader>
    varying vec2 vUV;
    
    void main() {
    
    	vUV = 0.75 * uv;
    
    	vec4 mvPosition = modelViewMatrix * vec4( position, 1.0 );
    
    	gl_Position = projectionMatrix * mvPosition;
    
    }
    </vertexshader>
    <fragmentshader>
    uniform sampler2D texture;
    varying vec2 vUV;
    
    vec4 pack_depth( const in float depth ) {
    
    	const vec4 bit_shift = vec4( 256.0 * 256.0 * 256.0, 256.0 * 256.0, 256.0, 1.0 );
    	const vec4 bit_mask  = vec4( 0.0, 1.0 / 256.0, 1.0 / 256.0, 1.0 / 256.0 );
    	vec4 res = fract( depth * bit_shift );
    	res -= res.xxyz * bit_mask;
    	return res;
    
    }
    
    void main() {
    
    	vec4 pixel = texture2D( texture, vUV );
    
    	if ( pixel.a < 0.5 ) discard;
    
    	gl_FragData[ 0 ] = pack_depth( gl_FragCoord.z );
    
    }
    </fragmentshader>[/code:1g7bi418]
    And I tried loading it via the action to "set material to shader."
    It doesn't give any errors, so I assume it loads, but it doesn't change anything. It doesn't cast the shadows correctly.
    I have alphatest set at 0.5, and I have blending set off. And I've also tried without those settings.
    
    Any help getting shadows cast correctly for models with alphatest set would be great. I need it to take into consideration the alpha when casting shadows.
    
    I notice in the example they have this set:
    [code:1g7bi418]
    object.customDepthMaterial = new THREE.ShaderMaterial( { uniforms: uniforms, vertexShader: vertexShader, fragmentShader: fragmentShader } );[/code:1g7bi418]
    I think that might be important? (customDepthMaterial)
  • I like the concept. Simple to play. Nice work

  • cool, I'll have to check it out when it is available.

  • oh okay, yea I guess that makes sense if you just add to the end- kind of makes it difficult to cycle through them though if you need to reference the value in construct2, because then you need to know which number relates to which variable ahead of time. Or maybe not.. I haven't checked how you modify effect values in construct.

  • Jermfire , if your game is easily cloned, then you may want to rethink whether that game is as good as you think it is- so you're basically proving my point.

  • what happens if you add another variable down the road? You wouldn't be able to load previous codes. Perhaps you should add tags to each value so it doesn't matter if you add variables in the future.

  • Looks great PixelMonkey , by behaviour are you saying a behaviour addon for construct2? or is it just a mechanic you're working on for your own needs?

  • That definitely solved it!!! Awesome job, and thanks so much!! That should be a quick fix for Quazi! The C2 community is kinda the best imo

    no problem!

    btw, your game is looking really cool.

  • Try Construct 3

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

    Try Now Construct 3 users don't see these ads
  • brent_hamel , QuaziGNRLnose

    Okay I found a fix.

    In the runtime.js of the Q3D Model, on line 3796 there is a typo;

    this.mat.alphatest = alphatest;

    It should be a capital T, like so;

    this.mat.alphaTest = alphatest;

    I also re-enabled the action in edittime.js on line 244;

    changed

    af_deprecated

    to

    af_none

    Then I used the action to set the alphatest value to 0.5 on the model

    I also set the transparency OFF as well on the model.

    This should fix your issue brent_hamel

    Apparently judging by this comment in the edittime on line 241;

    // these two weren't really having any effect in webgl renderer, so they're deprecated

    You must have overlooked a typo, QuaziGNRLnose , which is why it appeared not to be having any effect.

    So if you fix the typo it will work again.

  • QuaziGNRLnose , what if all your objects use transparency? Is there a way to use the alpha test?

    also, setting transparency on doesn't fix the issue.

  • brent_hamel , QuaziGNRLnose

    I found this link that talks about the issue: https://github.com/mrdoob/three.js/issues/4724

    It mentions disabling Alpha blending and using Alpha Testing, which I think may be a solution, but I'm not sure how it applies in Q3D. Maybe Quazi can let us know how to disable alpha blending and adjust the alpha testing to solve the issue? I saw there is an action to adjust it, but it requires a material name- and I'm not sure what name to use (how to get material name a model is using).

  • brent_hamel , hmm I don't know how to fix that. Maybe QuaziGNRLnose knows how? I'd be interested too since that seems like an important thing to get working correctly.

  • brent_hamel ,

    Are there sprites behind the model? Sprites won't show up behind models with transparent bits.

    If they are models behind the models, are their position further away from the camera? If they are the same position as the model with transparent bits, the model without transparent bits might not show(because the camera may not know which one to render first based on distance from camera)..