terrain lighting problem and texture problem.
#1
Posted 04 July 2012 - 12:29 AM
The first is about lighting, i have a HUGE terrain 3500x3500 and the camera is at z 10, i need to use lighting but for some reason its always black...
All the triangles are facing upward (the right direction), im also using culling so im 100% sure the triangles are facing the right direction; i tested placing on the terrain some d3d_draw_... blocks, walls, etc.. They get lit but the terrain dont, also the huge floors at the sides of the terrain gets lit (they are d3d_draw_floor)...
Is there problems with lights in models or am i doing something wrong? If you need more infos just ask me i will give any needed one =)
The second is that im trying to put some grass on the terrain, creating wall models not by d3d_model_wall but with primitives this way i can put all the game's textures in a single image and using UV coords. The problem is that the texture starts from the bottom right vertex stretching it so weirdly, i tried changing the order of the vertexes but nothing changed at all, how can i fix this?
Thank you if you can help me with this :D
#2
Posted 04 July 2012 - 12:56 AM
Edited by oopl.x.beast, 04 July 2012 - 12:56 AM.
#3
Posted 04 July 2012 - 12:59 AM
drawing to white is set always before anything i draw :3Do you set your draw color to white before you define the lighting point? That's a common mistake.
#4
Posted 04 July 2012 - 01:14 AM
Once you see your terrain, enable lighting.
Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
Edited by PoniesForPeace, 04 July 2012 - 01:15 AM.
#5
Posted 04 July 2012 - 01:22 AM
normals? I dont even have an idea of what they are xDsounds to me you didn't mention anything about normals. set color to c_white like he said, and set d3d_set_lighting(0) (false). This is just a test.
Once you see your terrain, enable lighting.
Could this be the problem?
I use no terrain system, i made my own one...Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
So seems like those "normals" are the problem :S how do i set them?
#6
Posted 04 July 2012 - 01:30 AM
normals? I dont even have an idea of what they are xD
sounds to me you didn't mention anything about normals. set color to c_white like he said, and set d3d_set_lighting(0) (false). This is just a test.
Once you see your terrain, enable lighting.
Could this be the problem?I use no terrain system, i made my own one...Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
So seems like those "normals" are the problem :S how do i set them?
Well if you're new you don't really have to understand them yet, you didn't write the terrain loader from scratch did you? Anyway I'd browse through the forums for a terrain engine that supports lights and normals, you should be able to tell from the screenshot if it does.
A normal is basically this, imagine a triangle, hold it to your face, like a mirror. the line from the triangle to your face is the normal. basically, it is the line pointing right at you if you are holding the triangle like a mirror in your bathroom. the renderer needs this data (the normal data in order to calculate the proper lighting.)
Edited by PoniesForPeace, 04 July 2012 - 01:31 AM.
#7
Posted 04 July 2012 - 01:40 AM
Yes i made it from scratch, it took me almost 2 months, i dont rly want to get a terrain system from other ppl, this is the reason i spent so much time on it :D
normals? I dont even have an idea of what they are xD
sounds to me you didn't mention anything about normals. set color to c_white like he said, and set d3d_set_lighting(0) (false). This is just a test.
Once you see your terrain, enable lighting.
Could this be the problem?I use no terrain system, i made my own one...Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
So seems like those "normals" are the problem :S how do i set them?
Well if you're new you don't really have to understand them yet, you didn't write the terrain loader from scratch did you? Anyway I'd browse through the forums for a terrain engine that supports lights and normals, you should be able to tell from the screenshot if it does.
A normal is basically this, imagine a triangle, hold it to your face, like a mirror. the line from the triangle to your face is the normal. basically, it is the line pointing right at you if you are holding the triangle like a mirror in your bathroom. the renderer needs this data (the normal data in order to calculate the proper lighting.)
So where could i find a tut or whatever on how to set the normals?
#8
Posted 04 July 2012 - 01:45 AM
study the editable examples, i bet there are also tutorials on it if you search for them. Also, you should search for the normal equation, it will calculate it from three points (each triangle may have a different normal.)Yes i made it from scratch, it took me almost 2 months, i dont rly want to get a terrain system from other ppl, this is the reason i spent so much time on it :D
normals? I dont even have an idea of what they are xD
sounds to me you didn't mention anything about normals. set color to c_white like he said, and set d3d_set_lighting(0) (false). This is just a test.
Once you see your terrain, enable lighting.
Could this be the problem?I use no terrain system, i made my own one...Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
So seems like those "normals" are the problem :S how do i set them?
Well if you're new you don't really have to understand them yet, you didn't write the terrain loader from scratch did you? Anyway I'd browse through the forums for a terrain engine that supports lights and normals, you should be able to tell from the screenshot if it does.
A normal is basically this, imagine a triangle, hold it to your face, like a mirror. the line from the triangle to your face is the normal. basically, it is the line pointing right at you if you are holding the triangle like a mirror in your bathroom. the renderer needs this data (the normal data in order to calculate the proper lighting.)
So where could i find a tut or whatever on how to set the normals?
#9
Posted 04 July 2012 - 02:04 AM
ok! :D will look for some tutorials on the normals :D Could you please help me on the other problem too? :Dstudy the editable examples, i bet there are also tutorials on it if you search for them. Also, you should search for the normal equation, it will calculate it from three points (each triangle may have a different normal.)
Yes i made it from scratch, it took me almost 2 months, i dont rly want to get a terrain system from other ppl, this is the reason i spent so much time on it :D
normals? I dont even have an idea of what they are xD
sounds to me you didn't mention anything about normals. set color to c_white like he said, and set d3d_set_lighting(0) (false). This is just a test.
Once you see your terrain, enable lighting.
Could this be the problem?I use no terrain system, i made my own one...Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
So seems like those "normals" are the problem :S how do i set them?
Well if you're new you don't really have to understand them yet, you didn't write the terrain loader from scratch did you? Anyway I'd browse through the forums for a terrain engine that supports lights and normals, you should be able to tell from the screenshot if it does.
A normal is basically this, imagine a triangle, hold it to your face, like a mirror. the line from the triangle to your face is the normal. basically, it is the line pointing right at you if you are holding the triangle like a mirror in your bathroom. the renderer needs this data (the normal data in order to calculate the proper lighting.)
So where could i find a tut or whatever on how to set the normals?
EDIT:
While a whole day looking ANY topic about normals, even watched other websites and forums that talks about it, i've read literally hundreds of pages, still i have no idea on how they work, all i find is scripts that i dont know how to implement in my terrain system, as i understood the best way is about vertex normals not face normals, it makes the lighting more smooth, but i didnt found anything usefull or atleast understandable for who never used normals before
Edited by RevenantGhost, 04 July 2012 - 01:39 PM.
#10
Posted 04 July 2012 - 02:20 PM
ok! :D will look for some tutorials on the normals :D Could you please help me on the other problem too? :D
study the editable examples, i bet there are also tutorials on it if you search for them. Also, you should search for the normal equation, it will calculate it from three points (each triangle may have a different normal.)
Yes i made it from scratch, it took me almost 2 months, i dont rly want to get a terrain system from other ppl, this is the reason i spent so much time on it :D
normals? I dont even have an idea of what they are xD
sounds to me you didn't mention anything about normals. set color to c_white like he said, and set d3d_set_lighting(0) (false). This is just a test.
Once you see your terrain, enable lighting.
Could this be the problem?I use no terrain system, i made my own one...Then you'll have to define the vertex normals of your terrain with d3d_define_vertex_normal. Check to see if your terrain system has that included, if it doesn't you will have to switch to another one. Then create some lights (at least one point light near the player and some directional lights for testing. set the directional light rotation to random(360) each step, so you can make sure the lighting at least works.
So seems like those "normals" are the problem :S how do i set them?
Well if you're new you don't really have to understand them yet, you didn't write the terrain loader from scratch did you? Anyway I'd browse through the forums for a terrain engine that supports lights and normals, you should be able to tell from the screenshot if it does.
A normal is basically this, imagine a triangle, hold it to your face, like a mirror. the line from the triangle to your face is the normal. basically, it is the line pointing right at you if you are holding the triangle like a mirror in your bathroom. the renderer needs this data (the normal data in order to calculate the proper lighting.)
So where could i find a tut or whatever on how to set the normals?
EDIT:
While a whole day looking ANY topic about normals, even watched other websites and forums that talks about it, i've read literally hundreds of pages, still i have no idea on how they work, all i find is scripts that i dont know how to implement in my terrain system, as i understood the best way is about vertex normals not face normals, it makes the lighting more smooth, but i didnt found anything usefull or atleast understandable for who never used normals before
Most of those websites are for scholars and mathematicians, rarely do they try and make it presentable for newbies.
Anyway, your first lesson is this

I'll give you a hint, you divide it by the 3d distance of the origin and the normal.
#11
Posted 04 July 2012 - 03:05 PM
The lighting doesnt work so good, doesnt seem to work good with directional lights at all, so i used normal ones, placed one at the top-left corner of the terrain ace high to cover all the map like a sun, it worked, but the unlit parts (shadows) was unrealistically coal black, so i added to the other 3 sides 3 more lights but gray instead of white, the result is what you can see from the image, some parts are still weirdly lit and some triangles changes the lighting too quickly, no fading at all...
Another problem i noticed is that if i put a light on the player it wont project on the triangles under or around, only on specific faces, only on faces with a certain angle to the player, and the light is almost invisible as soon as i dont set a range of 1000 or so even if the player is right above the faces to lit...
By the way this is the code i used:
x1=argument0 y1=argument1 z1=argument2 x2=argument3 y2=argument4 z2=argument5 x3=argument6 y3=argument7 z3=argument8 nx = (y2 - y1) * (z3 - z1) - (z2 - z1) * (y3 - y1); ny = (z2 - z1) * (x3 - x1) - (x2 - x1) * (z3 - z1); nz = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); m=sqrt(power(nx,2) + power(ny,2) + power(nz,2)); nx /=m; ny /=m; nz /=m;
Edited by RevenantGhost, 04 July 2012 - 03:07 PM.
#12
Posted 04 July 2012 - 03:10 PM
The link, image, or whatever it is, is broken :S btw just 5 minutes ago tried to mix up some scripts i found around and this is the result:
Spoiler
The lighting doesnt work so good, doesnt seem to work good with directional lights at all, so i used normal ones, placed one at the top-left corner of the terrain ace high to cover all the map like a sun, it worked, but the unlit parts (shadows) was unrealistically coal black, so i added to the other 3 sides 3 more lights but gray instead of white, the result is what you can see from the image, some parts are still weirdly lit and some triangles changes the lighting too quickly, no fading at all...
Another problem i noticed is that if i put a light on the player it wont project on the triangles under or around, only on specific faces, only on faces with a certain angle to the player...
By the way this is the code i used:x1=argument0 y1=argument1 z1=argument2 x2=argument3 y2=argument4 z2=argument5 x3=argument6 y3=argument7 z3=argument8 nx = (y2 - y1) * (z3 - z1) - (z2 - z1) * (y3 - y1); ny = (z2 - z1) * (x3 - x1) - (x2 - x1) * (z3 - z1); nz = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); m=sqrt(power(nx,2) + power(ny,2) + power(nz,2)); nx /=m; ny /=m; nz /=m;
well you didn't smooth your normals, they should look blocky like that until you smooth them. in order to smooth them you need to take the normals from the 6 triangles surrounding the triangle and average them, using that as the normal for the new triangle.
here is the image

while you're at it, make it display the normal of the triangle the camera is closest to. that way you can debug the normals.
Edited by PoniesForPeace, 04 July 2012 - 03:11 PM.
#13
Posted 04 July 2012 - 06:22 PM
So actually i should make the normal of a triangle as result of the normal of the surrounding triangles? but if them do the same on the other side of the map there will be a "part" of the first triangle to the other side, like a chain, doesnt sound like something that would make the light more realistic, maybe i didnt understood what u meant :/ could u provide a quick script example of what u mean? =)
The link, image, or whatever it is, is broken :S btw just 5 minutes ago tried to mix up some scripts i found around and this is the result:Spoiler
The lighting doesnt work so good, doesnt seem to work good with directional lights at all, so i used normal ones, placed one at the top-left corner of the terrain ace high to cover all the map like a sun, it worked, but the unlit parts (shadows) was unrealistically coal black, so i added to the other 3 sides 3 more lights but gray instead of white, the result is what you can see from the image, some parts are still weirdly lit and some triangles changes the lighting too quickly, no fading at all...
Another problem i noticed is that if i put a light on the player it wont project on the triangles under or around, only on specific faces, only on faces with a certain angle to the player...
By the way this is the code i used:x1=argument0 y1=argument1 z1=argument2 x2=argument3 y2=argument4 z2=argument5 x3=argument6 y3=argument7 z3=argument8 nx = (y2 - y1) * (z3 - z1) - (z2 - z1) * (y3 - y1); ny = (z2 - z1) * (x3 - x1) - (x2 - x1) * (z3 - z1); nz = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); m=sqrt(power(nx,2) + power(ny,2) + power(nz,2)); nx /=m; ny /=m; nz /=m;
well you didn't smooth your normals, they should look blocky like that until you smooth them. in order to smooth them you need to take the normals from the 6 triangles surrounding the triangle and average them, using that as the normal for the new triangle.
here is the image
while you're at it, make it display the normal of the triangle the camera is closest to. that way you can debug the normals.
#14
Posted 04 July 2012 - 06:28 PM
yes you should make it a result of the surrounding normals. That usually means you need to do it in two passes. First show me the gmk with your blocky normals so I can see if they are correct or not. Once you define your blocky normals you save the normal data to a list. Then you calculate everything again reading from the list, but not modifying it at all. This means you store the final normals into an array or list seperate from the original list so you don't overwrite anything. Finally, once you are done you can delete the original list.So actually i should make the normal of a triangle as result of the normal of the surrounding triangles? but if them do the same on the other side of the map there will be a "part" of the first triangle to the other side, like a chain, doesnt sound like something that would make the light more realistic, maybe i didnt understood what u meant :/ could u provide a quick script example of what u mean? =)
The link, image, or whatever it is, is broken :S btw just 5 minutes ago tried to mix up some scripts i found around and this is the result:Spoiler
The lighting doesnt work so good, doesnt seem to work good with directional lights at all, so i used normal ones, placed one at the top-left corner of the terrain ace high to cover all the map like a sun, it worked, but the unlit parts (shadows) was unrealistically coal black, so i added to the other 3 sides 3 more lights but gray instead of white, the result is what you can see from the image, some parts are still weirdly lit and some triangles changes the lighting too quickly, no fading at all...
Another problem i noticed is that if i put a light on the player it wont project on the triangles under or around, only on specific faces, only on faces with a certain angle to the player...
By the way this is the code i used:x1=argument0 y1=argument1 z1=argument2 x2=argument3 y2=argument4 z2=argument5 x3=argument6 y3=argument7 z3=argument8 nx = (y2 - y1) * (z3 - z1) - (z2 - z1) * (y3 - y1); ny = (z2 - z1) * (x3 - x1) - (x2 - x1) * (z3 - z1); nz = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); m=sqrt(power(nx,2) + power(ny,2) + power(nz,2)); nx /=m; ny /=m; nz /=m;
well you didn't smooth your normals, they should look blocky like that until you smooth them. in order to smooth them you need to take the normals from the 6 triangles surrounding the triangle and average them, using that as the normal for the new triangle.
here is the image
while you're at it, make it display the normal of the triangle the camera is closest to. that way you can debug the normals.
#15
Posted 04 July 2012 - 06:46 PM
About the gmk, everything in it about normals is in that script there's nothing more about normals in it :Dyes you should make it a result of the surrounding normals. That usually means you need to do it in two passes. First show me the gmk with your blocky normals so I can see if they are correct or not. Once you define your blocky normals you save the normal data to a list. Then you calculate everything again reading from the list, but not modifying it at all. This means you store the final normals into an array or list seperate from the original list so you don't overwrite anything. Finally, once you are done you can delete the original list.
So actually i should make the normal of a triangle as result of the normal of the surrounding triangles? but if them do the same on the other side of the map there will be a "part" of the first triangle to the other side, like a chain, doesnt sound like something that would make the light more realistic, maybe i didnt understood what u meant :/ could u provide a quick script example of what u mean? =)
The link, image, or whatever it is, is broken :S btw just 5 minutes ago tried to mix up some scripts i found around and this is the result:Spoiler
The lighting doesnt work so good, doesnt seem to work good with directional lights at all, so i used normal ones, placed one at the top-left corner of the terrain ace high to cover all the map like a sun, it worked, but the unlit parts (shadows) was unrealistically coal black, so i added to the other 3 sides 3 more lights but gray instead of white, the result is what you can see from the image, some parts are still weirdly lit and some triangles changes the lighting too quickly, no fading at all...
Another problem i noticed is that if i put a light on the player it wont project on the triangles under or around, only on specific faces, only on faces with a certain angle to the player...
By the way this is the code i used:x1=argument0 y1=argument1 z1=argument2 x2=argument3 y2=argument4 z2=argument5 x3=argument6 y3=argument7 z3=argument8 nx = (y2 - y1) * (z3 - z1) - (z2 - z1) * (y3 - y1); ny = (z2 - z1) * (x3 - x1) - (x2 - x1) * (z3 - z1); nz = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); m=sqrt(power(nx,2) + power(ny,2) + power(nz,2)); nx /=m; ny /=m; nz /=m;
well you didn't smooth your normals, they should look blocky like that until you smooth them. in order to smooth them you need to take the normals from the 6 triangles surrounding the triangle and average them, using that as the normal for the new triangle.
here is the image
while you're at it, make it display the normal of the triangle the camera is closest to. that way you can debug the normals.
So, i create an array with all the normals (so an array of 360'000 entries, good bye ram and half hour to do the loop), then to make the normal of every triangle i mix the ones of the 6 surrounding triangles with what formula? :/
Btw my terrain is divided in 36 parts to make it able to be modified by bombs and such, that looks like another problem specially because if it takes 2 or 3 seconds every time it needs to rebuild a map part then is worth not using lighting.. Actually it takes around 0.3 seconds, if it takes more than 0.5 seconds the entire gameplay will be ruined..
#16
Posted 04 July 2012 - 07:37 PM
erg...you didn't say anything about deformable terrain beforehand...that really hampers things. It's called the average formula and I'm sure you know it...anyway it is not possible in GM to have an array larger than 32000. You should be starting out small anyway because this is only a test and you shouldn't make it calculate for 30 seconds every time you run a test. Make a small 16x16 terrain for now.About the gmk, everything in it about normals is in that script there's nothing more about normals in it :D
yes you should make it a result of the surrounding normals. That usually means you need to do it in two passes. First show me the gmk with your blocky normals so I can see if they are correct or not. Once you define your blocky normals you save the normal data to a list. Then you calculate everything again reading from the list, but not modifying it at all. This means you store the final normals into an array or list seperate from the original list so you don't overwrite anything. Finally, once you are done you can delete the original list.
So actually i should make the normal of a triangle as result of the normal of the surrounding triangles? but if them do the same on the other side of the map there will be a "part" of the first triangle to the other side, like a chain, doesnt sound like something that would make the light more realistic, maybe i didnt understood what u meant :/ could u provide a quick script example of what u mean? =)
The link, image, or whatever it is, is broken :S btw just 5 minutes ago tried to mix up some scripts i found around and this is the result:Spoiler
The lighting doesnt work so good, doesnt seem to work good with directional lights at all, so i used normal ones, placed one at the top-left corner of the terrain ace high to cover all the map like a sun, it worked, but the unlit parts (shadows) was unrealistically coal black, so i added to the other 3 sides 3 more lights but gray instead of white, the result is what you can see from the image, some parts are still weirdly lit and some triangles changes the lighting too quickly, no fading at all...
Another problem i noticed is that if i put a light on the player it wont project on the triangles under or around, only on specific faces, only on faces with a certain angle to the player...
By the way this is the code i used:x1=argument0 y1=argument1 z1=argument2 x2=argument3 y2=argument4 z2=argument5 x3=argument6 y3=argument7 z3=argument8 nx = (y2 - y1) * (z3 - z1) - (z2 - z1) * (y3 - y1); ny = (z2 - z1) * (x3 - x1) - (x2 - x1) * (z3 - z1); nz = (x2 - x1) * (y3 - y1) - (y2 - y1) * (x3 - x1); m=sqrt(power(nx,2) + power(ny,2) + power(nz,2)); nx /=m; ny /=m; nz /=m;
well you didn't smooth your normals, they should look blocky like that until you smooth them. in order to smooth them you need to take the normals from the 6 triangles surrounding the triangle and average them, using that as the normal for the new triangle.
here is the image
while you're at it, make it display the normal of the triangle the camera is closest to. that way you can debug the normals.
So, i create an array with all the normals (so an array of 360'000 entries, good bye ram and half hour to do the loop), then to make the normal of every triangle i mix the ones of the 6 surrounding triangles with what formula? :/
Btw my terrain is divided in 36 parts to make it able to be modified by bombs and such, that looks like another problem specially because if it takes 2 or 3 seconds every time it needs to rebuild a map part then is worth not using lighting.. Actually it takes around 0.3 seconds, if it takes more than 0.5 seconds the entire gameplay will be ruined..
Please post the gmk.
Edited by PoniesForPeace, 04 July 2012 - 07:37 PM.
#17
Posted 04 July 2012 - 09:24 PM
As you noticed i didnt asked for a gmk with stuff about normals even if that would've helped, for some reason i dont like editable examples, and dont want my 2 months work be an editable example, you know what i mean :D im so jealous if it
Im not talking about you, if u know about normals, thing that i dont know, im sure you would make what i made in 2 months, in 2 days. But lots of ppl would take it as an example to start with, or for a script dispenser, never gonna post it, im sorry.
About the average formula maybe i know it but im not english, and i dont know wich one is in my language :D
Aw is there really an array limit? lol i didnt know xD i never reached so big numbers, btw nope is not a test, is something to complete an already started project, i mean i was making this project, adding details to the ground and all, then i said: "well with lighting would look even better :D" but if i have to make the terrain smaller, take more time to rebuild a map part, flood the ram with huge arrays, take 15 years to load a map, i think ima go without lights and in that case thank you anyway for the help =)
EDIT:
i could store the normals in a 2d array making it reach only 600 and for the terrain part remake i could edit the normal of only the few "squares" with changed height, making it fast to remake the terrain part too :D
Edited by RevenantGhost, 04 July 2012 - 09:45 PM.
#18
Posted 04 July 2012 - 10:23 PM
lol send me a pm. using just one array, the max size of terrain would be 178x178... But the reasonable max size should be about 32x32 for deformable terrain. Here's a hint, don't 178x178 your terrain, unless you want to reboot your PC. for speed you could have multiple terrain sectors, only recalculating deformed terrain if the deformer is in a certain sector. basically it amounts to putting a bunch of terrains next to each other.My 2 months of work on a forum where the first newbie reading this can take it and call it as his own? no thank you
i can give all the infos you need but im not going to post the gmk =)
As you noticed i didnt asked for a gmk with stuff about normals even if that would've helped, for some reason i dont like editable examples, and dont want my 2 months work be an editable example, you know what i mean :D im so jealous if it
Im not talking about you, if u know about normals, thing that i dont know, im sure you would make what i made in 2 months, in 2 days. But lots of ppl would take it as an example to start with, or for a script dispenser, never gonna post it, im sorry.
About the average formula maybe i know it but im not english, and i dont know wich one is in my language :D
Aw is there really an array limit? lol i didnt know xD i never reached so big numbers, btw nope is not a test, is something to complete an already started project, i mean i was making this project, adding details to the ground and all, then i said: "well with lighting would look even better :D" but if i have to make the terrain smaller, take more time to rebuild a map part, flood the ram with huge arrays, take 15 years to load a map, i think ima go without lights and in that case thank you anyway for the help =)
EDIT:
i could store the normals in a 2d array making it reach only 600 and for the terrain part remake i could edit the normal of only the few "squares" with changed height, making it fast to remake the terrain part too :D
and with deformable terrain, you don't recalculate the lights. when the terrain is deformed the normals stay the same which doesn't look right but is hardly noticable.
the average formula is this, final_normal_x=(nx1+nx2+nx3+nx4+nx5+nx6)/6
do this for y and z, nx1 is the normal of a triangle touching the triangle you want to smooth and nx2 is another triangle next to it.
Edited by PoniesForPeace, 04 July 2012 - 10:25 PM.
#19
Posted 04 July 2012 - 11:08 PM
I apreciate all the help you are giving me :D But i think we have not understood one another xD Im not a newby :D my terrain is already subdivided in 36 "subterrains" and gets remade only the one/the ones involved in the terrain change :D I also made a LOD system :D And my terrain in 3500x3500 (350x350 squares, 700x700triangles) and i have no fps drop, specially because the map parts out of field of view are not drawn and culling helps a lot =)lol send me a pm. using just one array, the max size of terrain would be 178x178... But the reasonable max size should be about 32x32 for deformable terrain. Here's a hint, don't 178x178 your terrain, unless you want to reboot your PC. for speed you could have multiple terrain sectors, only recalculating deformed terrain if the deformer is in a certain sector. basically it amounts to putting a bunch of terrains next to each other.
My 2 months of work on a forum where the first newbie reading this can take it and call it as his own? no thank youi can give all the infos you need but im not going to post the gmk =)
As you noticed i didnt asked for a gmk with stuff about normals even if that would've helped, for some reason i dont like editable examples, and dont want my 2 months work be an editable example, you know what i mean :D im so jealous if it
Im not talking about you, if u know about normals, thing that i dont know, im sure you would make what i made in 2 months, in 2 days. But lots of ppl would take it as an example to start with, or for a script dispenser, never gonna post it, im sorry.
About the average formula maybe i know it but im not english, and i dont know wich one is in my language :D
Aw is there really an array limit? lol i didnt know xD i never reached so big numbers, btw nope is not a test, is something to complete an already started project, i mean i was making this project, adding details to the ground and all, then i said: "well with lighting would look even better :D" but if i have to make the terrain smaller, take more time to rebuild a map part, flood the ram with huge arrays, take 15 years to load a map, i think ima go without lights and in that case thank you anyway for the help =)
EDIT:
i could store the normals in a 2d array making it reach only 600 and for the terrain part remake i could edit the normal of only the few "squares" with changed height, making it fast to remake the terrain part too :D
and with deformable terrain, you don't recalculate the lights. when the terrain is deformed the normals stay the same which doesn't look right but is hardly noticable.
the average formula is this, final_normal_x=(nx1+nx2+nx3+nx4+nx5+nx6)/6
do this for y and z, nx1 is the normal of a triangle touching the triangle you want to smooth and nx2 is another triangle next to it.
Yes the lights needs to be recalculated, because not only explosives deforms it, also players can dig into the terrain going even 1000 under it, so the lights really need to be recalculated =)
Ooooh! Now i understand what was the average formula, here is named totally different xD
Im going to test it out and update you on the results :D Still, why does a light source coming from the player affect only faces facing a certain direction and directional lights work so weird?
#20
Posted 05 July 2012 - 12:35 AM
you might have calculated ur normals incorrectly, show me how you calculate it from a pmI apreciate all the help you are giving me :D But i think we have not understood one another xD Im not a newby :D my terrain is already subdivided in 36 "subterrains" and gets remade only the one/the ones involved in the terrain change :D I also made a LOD system :D And my terrain in 3500x3500 (350x350 squares, 700x700triangles) and i have no fps drop, specially because the map parts out of field of view are not drawn and culling helps a lot =)
lol send me a pm. using just one array, the max size of terrain would be 178x178... But the reasonable max size should be about 32x32 for deformable terrain. Here's a hint, don't 178x178 your terrain, unless you want to reboot your PC. for speed you could have multiple terrain sectors, only recalculating deformed terrain if the deformer is in a certain sector. basically it amounts to putting a bunch of terrains next to each other.
My 2 months of work on a forum where the first newbie reading this can take it and call it as his own? no thank youi can give all the infos you need but im not going to post the gmk =)
As you noticed i didnt asked for a gmk with stuff about normals even if that would've helped, for some reason i dont like editable examples, and dont want my 2 months work be an editable example, you know what i mean :D im so jealous if it
Im not talking about you, if u know about normals, thing that i dont know, im sure you would make what i made in 2 months, in 2 days. But lots of ppl would take it as an example to start with, or for a script dispenser, never gonna post it, im sorry.
About the average formula maybe i know it but im not english, and i dont know wich one is in my language :D
Aw is there really an array limit? lol i didnt know xD i never reached so big numbers, btw nope is not a test, is something to complete an already started project, i mean i was making this project, adding details to the ground and all, then i said: "well with lighting would look even better :D" but if i have to make the terrain smaller, take more time to rebuild a map part, flood the ram with huge arrays, take 15 years to load a map, i think ima go without lights and in that case thank you anyway for the help =)
EDIT:
i could store the normals in a 2d array making it reach only 600 and for the terrain part remake i could edit the normal of only the few "squares" with changed height, making it fast to remake the terrain part too :D
and with deformable terrain, you don't recalculate the lights. when the terrain is deformed the normals stay the same which doesn't look right but is hardly noticable.
the average formula is this, final_normal_x=(nx1+nx2+nx3+nx4+nx5+nx6)/6
do this for y and z, nx1 is the normal of a triangle touching the triangle you want to smooth and nx2 is another triangle next to it.
Yes the lights needs to be recalculated, because not only explosives deforms it, also players can dig into the terrain going even 1000 under it, so the lights really need to be recalculated =)
Ooooh! Now i understand what was the average formula, here is named totally different xD
Im going to test it out and update you on the results :D Still, why does a light source coming from the player affect only faces facing a certain direction and directional lights work so weird?
0 user(s) are reading this topic
0 members, 0 guests, 0 anonymous users












