|
possible bugs..
#447225
11/26/14 20:28
11/26/14 20:28
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
if I publish to a folder , it seems that cudart32_41_22.dll is not copied over in to the folder ,the engine then obviously complains about this ,I have to manually copy it .
something else that may be a bug also , when I create terrain at runtime or load terrain from file , and terrain lod is set above 0 , I cannot change the mesh with set_vertex , except for adding a frame wait of one for each vertex change inside the loop , if I didn't do it ,the terrain remains unchanged..
if I set terrain lod to zero ,I can apply vertex changes with set_vertex as usual but it means I have no lod for terrain . in the manual I read that set_vertex automatically updates lod meshes . it seems wrong to me somehow .
it would really help if wed-created regions could be iterated over from a list of type region ,instead of finding them by name perhaps ?
jb
Last edited by Wjbender; 12/01/14 12:09.
Compulsive compiler
|
|
|
Re: possible bugs..
[Re: jcl]
#447299
12/02/14 14:27
12/02/14 14:27
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
thank you jcl , and sorry I meant ent_setvertex , well I guess it makes sense to have 1 frame of update time needed , I then only need to find a way to apply hightmaps faster because I am stepping 1 pixel at a time which obviously takes ages from 1 vertex to the next with a frame wait of 1 in real time per step , anyone have any advice on how to step directly to each vertex in distance vs the step amount on the heightmap image in pixels ?
jb
Compulsive compiler
|
|
|
Re: possible bugs..
[Re: jcl]
#447318
12/04/14 11:51
12/04/14 11:51
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
I mean , if I need to apply a hightmap to a terrain with lod above 0 , if I had to step one pixel on the heightmap image to read its value ,then apply the height to the nearest vertex of the terrain ,how could I speed it up such that I skip directly to the next vertex instead of stepping 1 quant in 3d per pixel on the heightmap image ?
I have tried this but the wait(1) inside this loop makes it impossible for realtime , the reason I was trying to accomplish it in real time is because I wanted to generate terrains from coherent noise ,such that I only generate about 3x3 terrains at a time ,while moving through a large scale world ..
but ,I think it's going to be best to pre create the terrains and only load and unload them as I move through the world,because the fastest is to apply the hightmap on a terrain with lod set at 0 , then save it and then load it in the game with lod set above 0.
I thought the wait (1) and lod speed issue was clear from your response so what do you mean "what do I mean" ;-)
Compulsive compiler
|
|
|
Re: possible bugs..
[Re: Superku]
#447323
12/04/14 14:23
12/04/14 14:23
|
Joined: Mar 2011
Posts: 3,150 Budapest
sivan
Expert
|
Expert
Joined: Mar 2011
Posts: 3,150
Budapest
|
it works for me without waits, even with terrain lod:
int j;
for (j=1; j<=ent_status(terrain_entity,0); j++)
{
CONTACT* c = ent_getvertex(terrain_entity,NULL,j); // vertex number begins with 1 !
c.v.y += (float)worklevel; // DirectX coordinate ! y up ! float !
ent_setvertex(terrain_entity,c,j);
}
the only thing does not work is auto-update terrain vertex normals after deformation (which is not needed in case of the example above)
|
|
|
Re: possible bugs..
[Re: sivan]
#447330
12/04/14 16:58
12/04/14 16:58
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
since i havent worked with heightmaps before attempting this i took a piece of code from the tust library that apply's the heightmap to the terrain , it is this piece of code wich i cannot understand why lod doesnt work with it unless a wait(1) is added . the code in test_1 i took from the forum from sivan works fine with lod bigger than 0 . the code in test_2 is the one i attempted to use from a tust example but it does not work with lod above 0, in test_3 you can see it works fine with lod at 0 , in test_4 you can see it only works with lod above 0 if a wait(1) is added inside the loops ,why would this happen ? its not my own code because i needed an example and i encountered the lod thingy with it ,so i am not saying its supposed to work but i cannot quite understand why it does'nt ??
///////////////////////////////
#include <acknex.h>
#include <default.c>
//#define test_1
//#define test_2
//#define test_3
//#define test_4
function main()
{
vec_set(screen_size,vector(800,600,0));
vec_set(screen_color,vector(50,1,1)); // dark blue
vec_set(sky_color,vector(50,1,1)); // dark blue
video_window(NULL,NULL,0,"terrain test");
level_load("");
def_debug();
def_move();
vec_set(d3d_lodfactor,vector(1,2,3));
BMAP* hm = "noise.jpg";
#ifdef test_1
//test 1 works fine with lod>0
terrain_lod=4;
#endif
#ifdef test_2
//test 2 does not work with lod>0
terrain_lod=4;
#endif
#ifdef test_3
//test 3 is the same as test 2 but with lod==0 it works fine
terrain_lod=0;
#endif
#ifdef test_4
//test 4 is the same as test 2 but with a wait(1) in the loop is
//needed for every update before it works ???
terrain_lod=4;
#endif
ENTITY *terrain=ent_createterrain(hm,nullvector,128,128,10);
//--------------------------------------------------------------
#ifdef test_1
//works fine with lod >0
int i=0;
for(i;i<ent_status(terrain,0);i++)
{
CONTACT *pos=ent_getvertex(terrain,NULL,i);
pos.v.y+=random(32);
ent_setvertex(terrain,pos,i);
}
#endif
//--------------------------------------------------------------
#ifdef test_2
//does not work with lod>0
int sx = bmap_width(hm);
int sy = bmap_height(hm);
int x=0,y=0;
VECTOR pos;
COLOR pixcol;
var format = bmap_lock(hm, 0);
for(x=0; x<sx; x++)
{
for(y=0; y<sx; y++)
{
VECTOR* pos = vector(
(terrain.x - terrain.min_x) - x * ((terrain.max_x - terrain.min_x) / sx),
(terrain.y - terrain.min_y) - y * ((terrain.max_y - terrain.min_y) / sy),0);
var v = ent_nextvertex(terrain, pos);
CONTACT* cpos = ent_getvertex(terrain,NULL,v);
var pix = pixel_for_bmap(hm, sx -x, y);
pixel_to_vec(pixcol, NULL, format, pix);
cpos.z = 0.1+(pixcol.blue );
cpos.v=NULL;
ent_setvertex(terrain,cpos,v);
}
}
bmap_unlock(hm);
#endif
//--------------------------------------------------------------
#ifdef test_3
//the same as test 2 but with no lod it works fine
int sx = bmap_width(hm);
int sy = bmap_height(hm);
int x=0,y=0;
VECTOR pos;
COLOR pixcol;
var format = bmap_lock(hm, 0);
for(x=0; x<sx; x++)
{
for(y=0; y<sx; y++)
{
VECTOR* pos = vector(
(terrain.x - terrain.min_x) - x * ((terrain.max_x - terrain.min_x) / sx),
(terrain.y - terrain.min_y) - y * ((terrain.max_y - terrain.min_y) / sy),0);
var v = ent_nextvertex(terrain, pos);
CONTACT* cpos = ent_getvertex(terrain,NULL,v);
var pix = pixel_for_bmap(hm, sx -x, y);
pixel_to_vec(pixcol, NULL, format, pix);
cpos.z = 0.1+(pixcol.blue );
cpos.v=NULL;
ent_setvertex(terrain,cpos,v);
}
}
bmap_unlock(hm);
#endif
//--------------------------------------------------------------
#ifdef test_4
//the same as test 2 but needs a wait(1) in the loop before it works ??
int sx = bmap_width(hm);
int sy = bmap_height(hm);
int x=0,y=0;
VECTOR pos;
COLOR pixcol;
var format = bmap_lock(hm, 0);
for(x=0; x<sx; x++)
{
for(y=0; y<sx; y++)
{
VECTOR* pos = vector(
(terrain.x - terrain.min_x) - x * ((terrain.max_x - terrain.min_x) / sx),
(terrain.y - terrain.min_y) - y * ((terrain.max_y - terrain.min_y) / sy),0);
var v = ent_nextvertex(terrain, pos);
CONTACT* cpos = ent_getvertex(terrain,NULL,v);
var pix = pixel_for_bmap(hm, sx -x, y);
pixel_to_vec(pixcol, NULL, format, pix);
cpos.z = 0.1+(pixcol.blue );
cpos.v=NULL;
ent_setvertex(terrain,cpos,v);
wait(1);////why ???
}
}
bmap_unlock(hm);
#endif
}
uncomment the defines for each test
Last edited by Wjbender; 12/04/14 17:12.
Compulsive compiler
|
|
|
Re: possible bugs..
[Re: Wjbender]
#447336
12/05/14 07:09
12/05/14 07:09
|
Joined: Mar 2012
Posts: 927 cyberspace
Wjbender
OP
User
|
OP
User
Joined: Mar 2012
Posts: 927
cyberspace
|
@superku that sounds good ,working from the vertex side towards the bmap instead of the other way around , thanks I will try this out with iteration over the terrain vertices directly ,any way of doing something faster and more efficient is super in my book .
Compulsive compiler
|
|
|
|