Gamestudio Links
Zorro Links
Newest Posts
Change chart colours
by 7th_zorro. 05/11/24 09:25
Data from CSV not parsed correctly
by dr_panther. 05/06/24 18:50
AUM Magazine
Latest Screens
The Bible Game
A psychological thriller game
SHADOW (2014)
DEAD TASTE
Who's Online Now
2 registered members (TipmyPip, AndrewAMD), 1,151 guests, and 4 spiders.
Key: Admin, Global Mod, Mod
Newest Members
Hanky27, firatv, wandaluciaia, Mega_Rod, EternallyCurious
19051 Registered Users
Previous Thread
Next Thread
Print Thread
Rate Thread
view_check() rerturns incorrect results #358218
02/09/11 22:52
02/09/11 22:52
Joined: Feb 2011
Posts: 135
Myrkling Offline OP
Member
Myrkling  Offline OP
Member

Joined: Feb 2011
Posts: 135
Remark: This is a bug report. As I wasn't able to create a new thread in the Bug Hunt forums, I posted this here instead. Perhaps someone could be so kind to move this thread to the right place. Thanks.


In certain circumstances view_check() returns incorrect results for both bounding boxes and points (A8.10.1).

The following example demonstrates the issue (you have to fly around a little bit). Depending on the camera's position and angle view_check() returns 0, even though the box/point is inside the view frustum completely.
Code:
#include <acknex.h>
#include <default.c>

#define PRAGMA_PATH "%EXE_DIR%\templates\models";

void main()
{
    level_load(NULL);
    ent_create("sf_alien.mdl", vector(90,90,0), NULL);
    ent_create("sf_alien.mdl", NULLVECTOR, NULL);
    wait(2);
    
    while (1)
    {
        draw_box3d(vector(-16,-16,-16), vector(16,16,16), COLOR_GREEN, 100);
        if (view_check(camera,vector(-16,-16,-16),vector(16,16,16)) != 0) {
            draw_text("IN VIEW",100,50, COLOR_GREEN);
        }
        
        draw_point3d(vector(0,-128,0), COLOR_RED, 100, 1);
        if (view_check(camera,vector(0,-128,0),vector(0,-128,0)) != 0) {
            draw_text("IN VIEW",100,80, COLOR_RED);
        }
        
        wait(1);
    }
}


PS, as far as I can tell the problem doesn't occur in empty levels.

Re: view_check() rerturns incorrect results [Re: Myrkling] #358540
02/11/11 21:16
02/11/11 21:16
Joined: Feb 2011
Posts: 135
Myrkling Offline OP
Member
Myrkling  Offline OP
Member

Joined: Feb 2011
Posts: 135
Some moderator please move this thread to the Bug Hunt forum. Thanks.

Re: view_check() rerturns incorrect results [Re: Myrkling] #358632
02/12/11 14:57
02/12/11 14:57
Joined: Oct 2004
Posts: 900
Lgh
rojart Offline
User
rojart  Offline
User

Joined: Oct 2004
Posts: 900
Lgh
I checked your code and I came to the conclusion, that the view_check don't returns 2 as in my example.
I've mentioned this in the beta thread, too.
Code:
#include <default.c>

STRING* sDrawTxt1;
STRING* sDrawTxt2;

void uu1ViewCheck(){
	switch(uu1){
		case 0:
		sDrawTxt1="0 - Box is fully outside the view frustum.";
		break;
		case 1:
		sDrawTxt1="1 - Box is partially inside the view frustum.";
		break;
		case 2:
		sDrawTxt1="2 - Box is fully inside the view frustum.";
		break;
	}
}

void uu2ViewCheck(){
	switch(uu2){
		case 0:
		sDrawTxt2="0 - Point is fully outside the view frustum.";
		break;
		case 1:
		sDrawTxt2="1 - Point is partially inside the view frustum.";
		break;
		case 2:
		sDrawTxt2="2 - Point is fully inside the view frustum.";
		break;
	}
}

void main()
{
	video_aspect = 4./3.;
	level_load(0);
	wait(2);

	vec_set(camera.x,vector(0,0,10));
	vec_set(camera.pan,vector(-10,-20,0));
	camera.clip_near = 1;
	camera.clip_far  = 60;
	camera.arc = 90;

	def_debug();
	
	int i=2;
	while (1){
		
		uu1ViewCheck();uu2ViewCheck();
	
		draw_box3d(vector(-4,-4,-4), vector(4,4,4), COLOR_GREEN, 100);
		draw_point3d(vector(0,-30,0), COLOR_RED, 100, 1);
		
		if(uu1 = view_check(camera,vector(-4,-4,-4),vector(4,4,4))){}
		draw_text(sDrawTxt1,5,120, COLOR_GREEN);
		
		if(uu2 = view_check(camera,vector(0,-30,0),vector(0,-30,0))){}
		draw_text(sDrawTxt2,5,140, COLOR_RED);
		
		if(camera.x <= -90) i=-2;
		if(camera.x >=  30) i= 2;
		
		camera.x -= i * time_step;
		camera.x = clamp (camera.x,-90,30);
		wait(1);
	}
}




Regards, Robert

Quote
Everything should be made as simple as possible, but not one bit simpler.
by Albert Einstein

PhysX Preview of Cloth, Fluid and Soft Body

A8.47.1P
Re: view_check() rerturns incorrect results [Re: rojart] #438793
03/21/14 14:41
03/21/14 14:41
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline
Senior Member
Benni003  Offline
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Hi I have the same problem....
view_check() seems to be unusable if there are Entities in the Level.
Is there any workarround for this BUG ??

Re: view_check() rerturns incorrect results [Re: Benni003] #438886
03/22/14 21:22
03/22/14 21:22
Joined: Aug 2008
Posts: 394
Germany
Benni003 Offline
Senior Member
Benni003  Offline
Senior Member

Joined: Aug 2008
Posts: 394
Germany
Ich habe doch tatsächlich eine Möglichkeit gefunden, diesen Bug zu umgehen laugh
Die Funktion, die view_check() enthält einfach aufrufen, bevor irgendeine Entity gerendert wurde.:

render_sky = f_view_check;


Moderated by  jcl, Nems, Spirit, Tobias 

Gamestudio download | chip programmers | Zorro platform | shop | Data Protection Policy

oP group Germany GmbH | Birkenstr. 25-27 | 63549 Ronneburg / Germany | info (at) opgroup.de

Powered by UBB.threads™ PHP Forum Software 7.7.1