Jump to content

Search the Community

Showing results for tags 'samples'.

  • Search By Tags

    Type tags separated by commas.
  • Search By Author

Content Type


Forums

  • HTML5 Game Coding
    • News
    • Game Showcase
    • Facebook Instant Games
    • Web Gaming Standards
    • Coding and Game Design
    • Paid Promotion (Buy Banner)
  • Frameworks
    • Pixi.js
    • Phaser 3
    • Phaser 2
    • Babylon.js
    • Panda 2
    • melonJS
    • Haxe JS
    • Kiwi.js
  • General
    • General Talk
    • GameMonetize
  • Business
    • Collaborations (un-paid)
    • Jobs (Hiring and Freelance)
    • Services Offered
    • Marketplace (Sell Apps, Websites, Games)

Find results in...

Find results that contain...


Date Created

  • Start

    End


Last Updated

  • Start

    End


Filter by number of...

Joined

  • Start

    End


Group


Website URL


Twitter


Skype


Location


Interests

Found 2 results

  1. hi i start write some documentation here for custom material ( its realy easy for me to make it here but i can move it in documentation after that complete ) definition : Custom Material inherited from stable version of Standard material (a carbon Copy of BABYLON.StandarMaterial) when we need CustomMaterial ? : any time you wanna make any custom option but you can't manage that in standard material . vertex shader definitions : position(readonly) or positionUpdated(vec3) : local position per vertex normal(readonly) or NormalUpdated(vec3) : local normal fragment shader definitions : vPositionW( readonly) : world position per pixel vNormalW(read only) vDiffuseUV(vec2) : (readonly) : defined uv attribute append when you have DiffuseTexture diffuseColor(vec3) you can manage that with Fragment_Custom_Diffuse : for control Diffuse color **** that mixed with diffuseTexture if you add any texture alpha(float) you can manage that from Fragment_Custom_alpha : for control transparency color(vec4) last result after attached all effect (light fog shadow ... ) you can manage that in Fragment_before_FragColor methods : Start .material = new BABYLON.CustomMaterial("name",scene); Demo : You can define customMaterial exactly like StandardMaterial and you have all property and methods in custom material too AddUniform material.AddUniform('test1','vec3'); simple (float,vec2, vec3,vec4,...) demo sampler without UV with Define UV array array3 , float Fragment_Begin material.Fragment_Begin( string) #include<__decl__defaultFragment> [Fragment_Begin] #extension GL_OES_standard_derivatives : enable for define any new extension or include any shader (not find any requirement for make sample) Fragment_Definitions material.Fragment_Definitions( string) #[Fragment_Definitions] void main(void) { this define before main you can define any varying or global function before main demo : make varying for simple noise used vertex data to add normal demo : change vertex use definition function Fragment_MainBegin void main(void) { vNormalW = vNormalW_helper; #[Fragment_MainBegin] demo : correct normal for back face Fragment_Custom_Diffuse you most find your result red and green and blue (witch any way you like ) and set it in diffuseColor or result *** result (vec3) in this method replaced (one time) by diffuseColor set texture setTexture use diffuseColor Fragment_Custom_Alpha you most find your alpha and set it to alpha variable or in result *** result (vec3) in this method replaced (one time) byalpha demo manage transparency Fragment_Before_FragColor before the last result you have chance to manage your result your final color available in color variable and you most be set it color after your changes *** result (vec4) in this method replaced (one time) by color demo result with and without light effect Vertex_Begin for define any new extension or include any shader (not find any requirement for make sample) Vertex_Definitions this define before main you can define any varying or global function before main Vertex_MainBegin same as Fragment_Main Vertex_Before_PositionUpdated localPosition = positionUpdated; #[Vertex_Before_PositionUpdated] gl_Position=viewProjection*finalWorld*vec4(positionUpdated,1.0); you most change positionUpdated in here for change last vertex result Vertex_Before_NormalUpdated #ifdef NORMAL #[Vertex_Before_NormalUpdated] localNormal = normalUpdated; vNormalW_helper=normalize(vec3(finalWorld*vec4(normalUpdated,0.0))); you most change normalUpdated in here for change last vertex normal result related samples Update Uniform demo
  2. Trying to learn Pixi i created this small file: PixiRenderer.js define(["references/pixi"], function(PIXI) { var PixiRenderer = function(){ var renderer = PIXI.autoDetectRenderer(800, 600,{backgroundColor : 0x1099bb}); document.body.appendChild(renderer.view); // create the root of the scene graph var stage = new PIXI.Container(); // create a texture from an image path var texture = PIXI.Texture.fromImage("assets/bunny.png"); // create a new Sprite using the texture var bunny = new PIXI.Sprite(texture); stage.addChild(bunny); renderer.render(stage); } return new PixiRenderer();});My html: index.html <html> <head> <script data-main="scripts/PixiRenderer" src="scripts/Require.js"></script> </head> <body> </body></html>I can see the canvas added to the DOM and the blue background is rendered but the bunny is missing ! There are no errors in console, everything seems to be working alright And im using local Node.js server to get the files so the bunny.png saved locally on my machine but my browser can still access it now if i replace renderer.render(stage);with animate();function animate() { requestAnimationFrame(animate); renderer.render(stage);}everything works. Can anyone tell me what is the problem ?
×
×
  • Create New...