Java-Gaming.org    
Featured games (91)
games approved by the League of Dukes
Games in Showcase (580)
games submitted by our members
Games in WIP (499)
games currently in development
News: Read the Java Gaming Resources, or peek at the official Java tutorials
 
    Home     Help   Search   Login   Register   
Pages: [1]
  ignore  |  Print  
  interpolation woes!  (Read 667 times)
0 Members and 1 Guest are viewing this topic.
Offline moogie

JGO Knight


Medals: 11
Projects: 5
Exp: 10 years


Java games rock!


« Posted 2008-01-11 03:26:06 »



Woe is me  Tongue

I have been battling with implementing textures on to spheres but have hit problem in my implementation. There seems to be a ring on the sphere which is not part of the texture.

Originally I assumed that it is due the discontinuity of the arctan function which causes this artifact when texturing. however many hours later it was suggested that it could be an artifact of interpolation of the texture co-ordinates of the corners of a quad where texure wraps around to the start again.

This seems to have been the problem as soon as i removed interpolation the seam disappears.

I need to some how modify the texture coordinates of each corner such that they are in the same range.

How does one do that? I have code which can detect the edge of the texture and i have thought about adding 1.0 to the offending texture coordinate(s) however this can potentially lead to other corners now being out of the valid interoplation range...



Offline moogie

JGO Knight


Medals: 11
Projects: 5
Exp: 10 years


Java games rock!


« Reply #1 - Posted 2008-01-11 03:51:23 »

I have attempted to detect when a seam is within a quad and modify the offending coordinates so that when interpolated they are vaild, however changing one corner texture coordinate can lead to other corners now being out of range and so forth.

So i have had to check each corner against each other corner modfiying the offending coordinates as i go. It works now... however this seems horribly inefficent. is there a better/ faster way?

here is my current code which detects and modifys the offending coordinates for interpolation:

1  
2  
3  
4  
5  
6  
7  
8  
9  
10  
11  
12  
13  
14  
15  
16  
17  
18  
19  
20  
21  
22  
23  
24  
25  
26  
27  
28  
29  
30  
31  
32  
33  
34  
35  
36  
37  
38  
39  
40  
41  
42  
43  
44  
45  
46  
47  
48  
49  
50  
51  
52  
53  
54  
55  
56  
57  
58  
59  
60  
61  
62  
63  
64  
65  
66  
67  
68  
69  
70  
71  
72  
73  
74  
75  
76  
77  
78  
79  
80  
81  
82  
83  
84  
85  
86  
87  
88  
89  
90  
91  
92  
93  
94  
95  
96  
97  
98  
99  
100  
101  
102  
103  
104  
105  
106  
107  
108  
109  
110  
111  
112  
113  
114  
115  
116  
117  
118  
119  
120  
121  
122  
123  
124  
125  
126  
127  
// check for texture wrap around 

// check top left
temp=tx00-tx01;
if (temp>=0.5)
{
   ++tx01;
}
else if (temp<=-0.5)
{
   ++tx00;
}

temp=tx00-tx10;
if (temp>=0.5)
{
   ++tx10;
}
else if (temp<=-0.5)
{
   ++tx00;
}

temp=tx00-tx11;
if (temp>=0.5)
{
   ++tx11;
}
else if (temp<=-0.5)
{
   ++tx00;
}

// check bottom left
temp=tx01-tx00;
if (temp>=0.5)
{
   ++tx00;
}
else if (temp<=-0.5)
{
   ++tx01;
}

temp=tx01-tx10;
if (temp>=0.5)
{
   ++tx10;
}
else if (temp<=-0.5)
{
   ++tx01;
}

temp=tx01-tx11;
if (temp>=0.5)
{
   ++tx11;
}
else if (temp<=-0.5)
{
   ++tx01;
}


// check bottom right
temp=tx11-tx01;
if (temp>=0.5)
{
   ++tx01;
}
else if (temp<=-0.5)
{
   ++tx11;
}

temp=tx11-tx10;
if (temp>=0.5)
{
   ++tx10;
}
else if (temp<=-0.5)
{
   ++tx11;
}

temp=tx11-tx00;
if (temp>=0.5)
{
   ++tx00;
}
else if (temp<=-0.5)
{
   ++tx11;
}


// check top right
temp=tx10-tx01;
if (temp>=0.5)
{
   ++tx01;
}
else if (temp<=-0.5)
{
   ++tx10;
}

temp=tx10-tx00;
if (temp>=0.5)
{
   ++tx00;
}
else if (temp<=-0.5)
{
   ++tx10;
}

temp=tx10-tx11;
if (temp>=0.5)
{
   ++tx11;
}
else if (temp<=-0.5)
{
   ++tx10;
}


where:
tx00 is the U coordinate of the top left corner
tx10 is the U coordinate of the top right corner
tx01 is the U coordinate of the bottom left corner
tx11 is the U coordinate of the bottom right corner
Pages: [1]
  ignore  |  Print  
 
 
You cannot reply to this message, because it is very, very old.

 

Add your game by posting it in the WIP section,
or publish it in Showcase.

The first screenshot will be displayed as a thumbnail.

xsi3rr4x (46 views)
2014-04-15 18:08:23

BurntPizza (42 views)
2014-04-15 03:46:01

UprightPath (58 views)
2014-04-14 17:39:50

UprightPath (40 views)
2014-04-14 17:35:47

Porlus (56 views)
2014-04-14 15:48:38

tom_mai78101 (79 views)
2014-04-10 04:04:31

BurntPizza (138 views)
2014-04-08 23:06:04

tom_mai78101 (238 views)
2014-04-05 13:34:39

trollwarrior1 (199 views)
2014-04-04 12:06:45

CJLetsGame (207 views)
2014-04-01 02:16:10
List of Learning Resources
by SHC
2014-04-18 03:17:39

List of Learning Resources
by Longarmx
2014-04-08 03:14:44

Good Examples
by matheus23
2014-04-05 13:51:37

Good Examples
by Grunnt
2014-04-03 15:48:46

Good Examples
by Grunnt
2014-04-03 15:48:37

Good Examples
by matheus23
2014-04-01 18:40:51

Good Examples
by matheus23
2014-04-01 18:40:34

Anonymous/Local/Inner class gotchas
by Roquen
2014-03-11 15:22:30
java-gaming.org is not responsible for the content posted by its members, including references to external websites, and other references that may or may not have a relation with our primarily gaming and game production oriented community. inquiries and complaints can be sent via email to the info‑account of the company managing the website of java‑gaming.org
Powered by MySQL Powered by PHP Powered by SMF 1.1.18 | SMF © 2013, Simple Machines | Managed by Enhanced Four Valid XHTML 1.0! Valid CSS!