Hover Posted March 2, 2015 Share Posted March 2, 2015 So well let's see... I bought the Leadwerks Engine the last day because of the great price in the Steam Sale But what about rain? Is rain actually build-In or are there other ways to create some? If not: Is a rain / snow functionality planned for the future? Thanks for your answers! Quote Link to comment Share on other sites More sharing options...
AnthonyPython Posted March 2, 2015 Share Posted March 2, 2015 So well let's see... I bought the Leadwerks Engine the last day because of the great price in the Steam Sale But what about rain? Is rain actually build-In or are there other ways to create some? If not: Is a rain / snow functionality planned for the future? Thanks for your answers! rain/snow could be done with particles I think so, but you have to do it your self. not sure what is the most efficient way of doing this. but no it's not built-in yet, and carving tool, vertex editing/ vegetation tool , etc is suppose to come this year. I don't think this is planned for this year, but josh did say depending on time after getting those planned he may be able to do a few other things like this. Edit: best way of this is a shader Quote OS: Windows 10 Pro CPU: i3-10100 CPU @ 3.60GHz GPU: NVIDIA 2060 Super - 8 GB RAM: 32 GB Link to comment Share on other sites More sharing options...
YouGroove Posted March 2, 2015 Share Posted March 2, 2015 But what about rain? Is rain actually build-In or are there other ways to create some? You just use particles in a cylinder shape falling around the player or in front of it. So you just need to make that particle effect child object of your player object in scene editor, so it will follow your player. And you can switch rain off and on by pausing or running the particle emitter. Your partilcles needs some Y initial speed like 30 , than a stronger acceleration like -60 , you can adjust that in the particle editor. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Hover Posted March 2, 2015 Author Share Posted March 2, 2015 Okay thank you guys for the answers! I think i would build something with particles, but first of all i had to learn how to work with the full editor and then the particle system. But i really like that support here in the forum. That builds me a good picture of all that here Quote Link to comment Share on other sites More sharing options...
Ronald Buanno Posted March 3, 2015 Share Posted March 3, 2015 I bought the Leadwerks Engine the last day because of the great price in the Steam Sale Lucky you and Unlucky you at the same time. Quote Ubuntu 14.04 (64-Bit) - Intel Core i7-2700K - Geforce GTX 670 - 8GB RAM Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 Lucky you and Unlucky you at the same time. Is your purpose here now to just give jabs at Leadwerks? We get it, you're unhappy with Leadwerks. A lot of people aren't. Move on already. 8 Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted March 3, 2015 Share Posted March 3, 2015 You might want to try this PostFx-Shader I derived from http://glsl.herokuapp.com/e#14949.0 You might want to play around with some of the values but I think, it's a good start. Vertex-Shader: #version 400 uniform mat4 projectionmatrix; uniform mat4 drawmatrix; uniform vec2 offset; uniform vec2 position[4]; in vec3 vertex_position; void main(void) { gl_Position = projectionmatrix * (drawmatrix * vec4(position[gl_VertexID]+offset, 0.0, 1.0)); } Fragment-Shader: #version 400 float torad(float deg){ return deg*3.14/180; } uniform bool isbackbuffer; uniform float currenttime; uniform vec2 buffersize; uniform sampler2D texture1; out vec4 fragData0; uniform mat4 projectioncameramatrix; void main( void ) { vec2 tcoord = vec2(gl_FragCoord.xy/buffersize); if (isbackbuffer) tcoord.y = 1.0 - tcoord.y; float aspect = buffersize.y/buffersize.x; tcoord.x = clamp(tcoord.x,0.0,1.0); tcoord.y = clamp(tcoord.y,0.0,1.0); vec2 position = ( gl_FragCoord.xy - buffersize.xy*.5 ) / buffersize.x; position.y+=projectioncameramatrix[1][3]; position.y-=1.0; // 256 angle steps float angle = atan(position.y,position.x)/(2.*3.14159265359); angle -= floor(angle); float rad = length(position); float color = 0.0; for (int i = 0; i < 10; i++) { float angleFract = fract(angle*256.); float angleRnd = floor(angle*256.)+1.; float angleRnd1 = fract(angleRnd*fract(angleRnd*.7235)*45.1); float angleRnd2 = fract(angleRnd*fract(angleRnd*.82657)*13.724); float t = currenttime*.005+angleRnd1*10.; float radDist = sqrt(angleRnd2+float(i)); float adist = radDist/rad*.1; float dist = (t*.1+adist); dist = abs(fract(dist)-.5); color += max(0.,.5-dist*40./adist)*(.5-abs(angleFract-.5))*5./adist/radDist; angle = fract(angle+.61); } fragData0 = texture(texture1,tcoord); fragData0 += vec4( color )*.3; } 1 Quote Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 @Ma does this stop raining inside? The biggest issue with particles, that don't have physics, as rain is having it not clip inside buildings. The test being standing inside a a buildings doorway and looking outside and seeing rain outside but having none inside. That's usually been the challenge with LE and rain in the past. Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted March 3, 2015 Share Posted March 3, 2015 @Rick No, it doesn't. I agree, that would be quite cool but I think, we would need higher powers (shadmar ) to achieve that Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 3, 2015 Share Posted March 3, 2015 The biggest issue with particles, that don't have physics, as rain is having it not clip inside buildings This has a big cost because it uses collisions. But you can use some raycast volumes and determine where some groups of particles should fall if they fall vertically. Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 raycasts have a cost as well though. A brute force way might be able to define a few areas in your map and each area makes the particle live a certain duration. So the areas over nothing the duration will last until it hits the ground and the areas over shelter will only last until the top of the shelter. It's sort of a pain to set this up but it's an easy but tedious manual way. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 3, 2015 Share Posted March 3, 2015 Why not simply using Navmesh polygons instead of collision ? It's just picking the right navmesh polygons around you and getting the heigh with a math formula. No collision, , no raycast, just simple search and math Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 That assumes the shelter doesn't have an interior. If it does have an interior there will be a navmesh inside so this wouldn't work. The most user friendly way is particles with physics. Other engines have this and there are tricks I'm sure that are done to make it not take that much processing power to do so, but I believe this requires Josh to setup as part of the engine. A library could possibly be made that runs on startup of the game and does some analysis on your level and creates all these particle emitters with a given area and duration to make it so buildings will have emitters over it where particles only last to the top of the building. It won't be perfect though with slopped roofs and such, but it could be all automatic. Quote Link to comment Share on other sites More sharing options...
YouGroove Posted March 3, 2015 Share Posted March 3, 2015 A library could possibly be made that runs on startup of the game and does some analysis on your level and creates all these particle emitters with a given area and duration to make it so buildings will have emitters over it where particles only last to the top of the building Plugins, once LE3 will grow more , plugins will be the next big thing to have, and people will make such editor addons Quote Stop toying and make games Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 My thought above wasn't really in the editor but would be a script you put in your scene that on startup would create these emitters, but yes editor plugins would be nice. Quote Link to comment Share on other sites More sharing options...
shadmar Posted March 3, 2015 Share Posted March 3, 2015 Even if rain was just shader, you still need to know when you are inside. Raycasting or similar would still be the way to detect that. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 @shadmar, but if looking outside you'd still need to show the rain out there. Is that possible to simulate that depth in a shader? To show the rain outside while you are inside? Seems like it would be pretty tricky to do that. Quote Link to comment Share on other sites More sharing options...
shadmar Posted March 3, 2015 Share Posted March 3, 2015 Yes you can use the depth texture for that if you know the distance to the wall/window/door. Or a rendertarget, render interior to one buffer and everything else to another, and just apply rain to the one. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Rick Posted March 3, 2015 Share Posted March 3, 2015 Yes you can use the depth texture for that if you know the distance to the wall/window/door. That seems like it might be a pain to work out. You could have any number of doors or windows in a interior. You'd almost have to label each one (key) then do an ForEachEntityInAABBDo to see which ones are around you and which are visible. Or a rendertarget, render interior to one buffer and everything else to another, and just apply rain to the one. This is interesting. Can you think of how you would identify such things as interior vs exterior such that the shader would know what to render where? Quote Link to comment Share on other sites More sharing options...
shadmar Posted March 3, 2015 Share Posted March 3, 2015 This is interesting. Can you think of how you would identify such things as interior vs exterior such that the shader would know what to render where? We don't really have a safe method for this other than using 2 worlds I think, which complicates stuff a alot for such a simple effect. Or you can always do some hacky stuff, like give all interior materials an alpha value of non 1 and just apply rain shader on everything alpha != 1, but you'll run into problems sooner or later when you add other alpha stuff. Maybe Josh have some better tip for this. Quote HP Omen - 16GB - i7 - Nvidia GTX 1060 6GB Link to comment Share on other sites More sharing options...
Hover Posted March 3, 2015 Author Share Posted March 3, 2015 You might want to play around with some of the values but I think, it's a good start. [...all the code-stuff...] I'm sorry but how can i bring that into Leadworks? Sorry i'm very new to this all... Quote Link to comment Share on other sites More sharing options...
Ma-Shell Posted March 3, 2015 Share Posted March 3, 2015 First you have to create a new shader with the given code. To do that navigate to "Shaders/PostEffects" in the "Assets"-Tab. Right-Click on the dark grey area and choose "New"->"Shader" Give it a name, e.g. "rain" Double-Click the newly created file. The script-editor should open. Navigate to the Vertex-Shader by pressing "Vertex" in the white area on the left of the script-editor and paste the Vertex-Shader-Code Navigate to the Fragment-Shader by pressing "Fragment" and paste the Fragment-Shader-Code and save. Close the script-editor and select the Root-Object in the "Scene"-tab Under "Post Effects" add the newly created shader Select your camera and check the "Use Post-Effects"-Checkbox in the "Camera"-Tab 1 1 Quote Link to comment Share on other sites More sharing options...
Hover Posted March 3, 2015 Author Share Posted March 3, 2015 Okay thank you, that works great! An other short question: How could i realize that an object is following my FPS-Controller? I tried to add a box as a child but the box doesn't move when i do.? Quote Link to comment Share on other sites More sharing options...
beo6 Posted March 4, 2015 Share Posted March 4, 2015 If you used CSG for your box, you might add an empty script to the box so it does not get merged with the rest of CSG. Quote Link to comment Share on other sites More sharing options...
burgelkat Posted January 21, 2017 Share Posted January 21, 2017 Hallo, i have a question to this : If i put my rain.Script to PostEffect (under Root) then it looks good. but if i use a trigger to aktivate the Posteffect, then it looks like the second Picture I put this in my player Script to activate the rain: function Script:Change()--in self.camera:AddPostEffect("Shaders/PostEffects/Rain.shader") end can someone explain me what i do wrong? thanks 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.