jessepmason Posted October 19, 2015 Share Posted October 19, 2015 Hello everyone... sorry for another noob question but I am learning and loving babylon! I am curious if babylon can project a texture onto multiple objects... similiar to how this is: http://playground.babylonjs.com/#1215MA but I want to be able to project from a specific point in the scene.. not from the active camera but maybe another camera in the scene? Thanks! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 19, 2015 Share Posted October 19, 2015 Hey Jesse! No problem There is no dumb question in this forum! So far if you need to project from a specific point in the scene you have to change the shader here:https://github.com/BabylonJS/Babylon.js/blob/master/src/Shaders/default.fragment.fx#L204 Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 19, 2015 Share Posted October 19, 2015 Maybe the mirrorTexture or the reflectionProbe thingies might help you, too? mirrorTexture: http://doc.babylonjs.com/tutorials/01._Advanced_Texturing (under the heading "mirror" pretty much at the top ) reflectionProbe: http://doc.babylonjs.com/tutorials/How_to_use_Reflection_probes And wouldn't it somehow be possible to use a dynamicTexture to display certain camera view? Somehow I think I saw something like this already, but I can't remember where... maybe I am confusing things here, so don't pin me down on that Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 19, 2015 Author Share Posted October 19, 2015 Thanks guys! I will have a look at the references and let you know if i come up with somethin! @iceman -- no your right.. i have seen that somewhere too Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 20, 2015 Author Share Posted October 20, 2015 Well... I got something.. it its no where near what i need but atleast i got a shader that projects something from a different camera... haha... sighI think this is a little out of my league right now http://www.vrmodify.com/projectionShader.html Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 20, 2015 Share Posted October 20, 2015 I am pretty sure that this can't be that hard... nobody else an idea? I think the reflectionProbes somehow sound like they do what you want... but I somehow don't think I really understand them :-/ Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 20, 2015 Author Share Posted October 20, 2015 yeah thats what I thought before i dug into it and got really confused I thought the reflectionProbe might be what I was looking for too since you can set your position but I cant get it to do what i wantIll continue to think about it Thanks! Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 20, 2015 Author Share Posted October 20, 2015 I think i am getting there http://www.vrmodify.com/projectionShade2r.html woo hoo Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 20, 2015 Share Posted October 20, 2015 Cool! With the custom shader..hmm.. I really thought it should be easier... but if it works for you... keep us uptated! Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 20, 2015 Author Share Posted October 20, 2015 haha yeah, I wish it was more straight forward to do it...I kind of found a three.js example and tried to mimic it but there are a few things i need to fix: 1) stop the image from changing position when you change the size of the browser at load time2) there is a weird white ring behind the camera is there a way I can share my scene in a babylon Playground with the custom shader? Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 20, 2015 Share Posted October 20, 2015 I think they talked about it here: http://www.html5gamedevs.com/topic/17660-shader-inside-a-variable/?hl=%2Bshader+%2Bvariable Does that help? (I try to avoid shaders, so I didn't read, just remembered there was a thread about it) Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 20, 2015 Author Share Posted October 20, 2015 thanks! may I ask why you try and avoid shaders?.... should i be avoiding also? Quote Link to comment Share on other sites More sharing options...
iiceman Posted October 20, 2015 Share Posted October 20, 2015 No no, of course not. Shaders are awesome as far as I know. I just never took the time to learn how to use them (yet). And I am kinda scared of them... looks like complicated jibber jabber to me. But you can do alot of great stuff with them, so if you already figured it all out, good for you! I'll catch up some time later... maybe RaananW 1 Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 21, 2015 Author Share Posted October 21, 2015 haha gotchya... yeah it still is to me too Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 22, 2015 Author Share Posted October 22, 2015 Would any shader gurus be able to help me out here?I am trying to get rid of the gigantic ring is this example: http://www.babylonjs-playground.com/#26UUE1 my cameras projection matrix is being plugged into my shader and whenever i do that I get this ring...sad faceAlso the ring gets bigger the farther you dolly out with the render camera :S I feel like its a simple fix and I am just missing something thanks! Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 22, 2015 Share Posted October 22, 2015 Something like this?http://www.babylonjs-playground.com/#26UUE1#1 Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 22, 2015 Author Share Posted October 22, 2015 unfortunately doesn't work for all scenarios :S http://vrmodify.com/projectionShader3_test2.html you can see by the time i am done clipping all the errors it starts clipping my projection :Ssomething weird is goin on Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 22, 2015 Author Share Posted October 22, 2015 I feel like this might have something to do with it?if i dont use an image with a black border around it the images edges get stretched http://www.babylonjs-playground.com/#26UUE1#2 Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 22, 2015 Share Posted October 22, 2015 actually you want to clamp the border and detect the corresponding .w Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 22, 2015 Author Share Posted October 22, 2015 please forgive me aren't I doing that? :S clamping:mainTexture.wrapU = BABYLON.Texture.CLAMP_ADDRESSMODE .w:if (texCoordProj.w > -2.){ Quote Link to comment Share on other sites More sharing options...
GameMonetize Posted October 23, 2015 Share Posted October 23, 2015 Clamping is done by keeping values between 0 to 1 but the test returns a black value which is different Quote Link to comment Share on other sites More sharing options...
jessepmason Posted October 23, 2015 Author Share Posted October 23, 2015 okay thanks! I really appreciate your help! 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.