igitz Posted December 29, 2017 Share Posted December 29, 2017 hi, anyone knows why changing the value of "pointSize" doesn't influence the size of points of a shaderMaterial? shaderMaterial.pointsCloud = true; shaderMaterial.pointSize = 10; Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 29, 2017 Share Posted December 29, 2017 Try: shaderMaterial.setFloat('pointSize', #); Quote Link to comment Share on other sites More sharing options...
igitz Posted December 29, 2017 Author Share Posted December 29, 2017 and? how do you use the float pointSize in the fragment shader? Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 29, 2017 Share Posted December 29, 2017 .... how ever you would want to .... This is assuming you already have your shader set up, and a uniform float of pointSize. GameMonetize 1 Quote Link to comment Share on other sites More sharing options...
igitz Posted December 29, 2017 Author Share Posted December 29, 2017 thanks for the quick replies! well, i'm trying to get something similar to http://www.babylonjs-playground.com/#OCR2S where .pointSize is a property of the material itself, but i'm using a shaderMaterial, so i'm not really sure how to set up the same effect in the fragment shader. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 29, 2017 Share Posted December 29, 2017 http://www.babylonjs-playground.com/#OCR2S Whoops ignore this I just comprehended what you asked. If you could make a PG with the shaderMaterial in question, I can help. Quote Link to comment Share on other sites More sharing options...
igitz Posted December 29, 2017 Author Share Posted December 29, 2017 ok thanks, it's more of a generic question, valid for any shaderMaterial that is applied to a Babylon Mesh. i can try to set up a PG by tomorrow. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 29, 2017 Share Posted December 29, 2017 It’s not generic if it’s a shader material and you did not inclued the point cloud stuff. a shader material you define yourself or compile from other shaders. So if there is no point cloud support on the shaderMaterial then it won’t do anything. The only reason it works with standard material is that shader has it set up and a setter for the variable pointSize that sets the value on the effect when it’s changed I’m assuming. @NasimiAsl what’s the quickest way to add point cloud support to his shader? I would just copy and paste the fragment code for the pointcloud stuff outta the standardMaterials shader. Quote Link to comment Share on other sites More sharing options...
igitz Posted December 29, 2017 Author Share Posted December 29, 2017 great, i get what you mean now. i assumed that since it is possible to use things like .wireframe = true; and .pointsCloud = true; with shaderMaterial, then pointSize would also be supported, but i get your point now. some help with copy pasting the pointsCloud code from the standardMaterial would be much appreciated. Quote Link to comment Share on other sites More sharing options...
Pryme8 Posted December 29, 2017 Share Posted December 29, 2017 If wireframe and pointCloud work then point size should work, odd. When I get home I’ll take a look. https://github.com/BabylonJS/Babylon.js/blob/master/src/Materials/babylon.shaderMaterial.ts I do not see anything here for wireframe or pointCloud support. Ill get you a better awnser once I’m off my phone and on a pc. Quote Link to comment Share on other sites More sharing options...
igitz Posted December 30, 2017 Author Share Posted December 30, 2017 shaderMaterial extends Material so i guess they should all be working (?) Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 30, 2017 Share Posted December 30, 2017 hi you wanna have fixed point size (because pointed size depended to camera distance between vertex )? Quote Link to comment Share on other sites More sharing options...
igitz Posted December 30, 2017 Author Share Posted December 30, 2017 well, yes i was thinking fixed point size, but if i see the standardMaterial pointSize code then i can also try to relate it to the camera distance. Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 30, 2017 Share Posted December 30, 2017 if you can find distance formula you can manage that by discard need more time to calculate that y = f( length(vPositionW-vEyePosition) ) ; f is your formula http://www.babylonjs-playground.com/#OCR2S#19 it is not depend your shader that control by webgl base kernel so you can just discard that find that i am stupid most of the time http://www.babylonjs-playground.com/#OCR2S#20 http://www.babylonjs-playground.com/#OCR2S#21 http://www.babylonjs-playground.com/#OCR2S#24 Quote Link to comment Share on other sites More sharing options...
NasimiAsl Posted December 30, 2017 Share Posted December 30, 2017 dear @Pryme8 i think you need add some uniform and use gl functions so you need make shader progress with this attribute vertexAttribPointer so actully i don't know a fast way to change shaderMaterial to Pointed ShaderMaterial Pryme8 1 Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.