Jump to content

Search the Community

Showing results for tags 'custommaterial'.

  • 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 5 results

  1. I'm picking up an older project again, and moving it to the current version of BJS. This is a pain, though, because I'd been extending the StandardMaterial shader within a copy of the BJS framework itself. The project made extensive use of noise and shape functions to simulate textures within the GPU by altering the diffuse, specular and normal values of the StandardMaterial, based on a flag hacked into the framework. The advantage of this method vs. ShaderMaterial was getting unlimited resolution textures at no bandwidth cost without having to reimplement all the goodies in the StandardMaterial--SSAO2, fog, shadows, etc. The disadvantage: Lack of portability, and having to find a way to re-minify everything myself before deployment. (My kingdom for uglify.js to support the `` multiline literal...) Before I start migrating my hacks, I wanted to ask this of the smart people around the water cooler: Can anyone suggest a more elegent way to do this, without modifying BJS itself?
  2. 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
  3. https://www.babylonjs-playground.com/#9HEBCE#27 When you turn ti the right you see a reflection on the floor. How can I set the specularColor in a customMaterial to reduce the amount of specularity?
  4. Hi, Playground: https://www.babylonjs-playground.com/#Y5IZCF#16 In the playground, if I use a uniform vec3, toggling scene.shadowsEnabled causes the ground to turn black. Not using uniform works. Is it a bug? Thank you very much!
  5. you can make your shader inside the StandardMaterial with CustomShader 1. make your Custom diffuse : http://www.babylonjs-playground.com/#0GG6MR http://www.babylonjs-playground.com/#0GG6MR#1 http://www.babylonjs-playground.com/#0GG6MR#14 2. manage color in last step http://www.babylonjs-playground.com/#0GG6MR#4 http://www.babylonjs-playground.com/#0GG6MR#5 http://www.babylonjs-playground.com/#FC4IX#71 // cel - toon shade - vertex update [in progress]
×
×
  • Create New...