Omnimaga: The Coders Of Tomorrow
Welcome, Guest. Please login or register.
 
Omnimaga: The Coders Of Tomorrow
20 June, 2013, 13:11:54 *
Welcome, Guest. Please login or register.

Login with username, password and session length
 
   home   news downloads projects tutorials misc forums rules new posts irc about Login Register  
+-OmnomIRC

You must Register, be logged in and have at least 40 posts to use this shout-box! If it still doesn't show up afterward, it might be that OmnomIRC is disabled for your group or under maintenance.

Note: You can also use an IRC client like mIRC, X-Chat or Mibbit to connect to an EFnet server and #omnimaga.

Pages: 1 [2] 3 4 ... 7   Go Down
  Print  
Author Topic: Texture drawing -  (Read 4049 times) Bookmark and Share
0 Members and 1 Guest are viewing this topic.
thepenguin77
z80 Assembly Master
LV10 31337 u53r (Next: 2000)
**********
Offline Offline

Gender: Male
Last Login: 18 June, 2013, 05:33:45
Date Registered: 14 December, 2009, 04:21:52
Location: Purdue
Posts: 1490


Total Post Ratings: +778

View Profile
« Reply #15 on: 14 June, 2011, 20:29:53 »
0

You can only check between the upper and lower points if in the virtual world, from where you are standing, they are one above another. But imagine you are standing at the bottom corner of a wall looking at the other corner of a wall. Now the points probably won't even be on the same X value. Although in reality, that formula is not about finding how tall the wall is, it's about figuring out what the scale factor you need to multiply your texture by.

And textures, I think this is where the misunderstanding is. If you simply draw a bounding box on the screen and fill it with a texture, yes, the wall will have a texture. But the texture won't change when the wall does. You could stand 2 feet from the wall, or 200 feet from the wall, and the texture would always be the same size. If the texture was a brick wall, at 200 feet away, the entire wall might just be a single brick. You have to scale the texture down so that as the wall gets smaller, the texture does too.

This same thing applies if you are looking at the wall from a weird angle, if you are doing what I said earlier, looking from the bottom corner to the top corner, obviously, the bricks closer to you will be bigger than the bricks farther away from you, and for this you need texture scaling.

Here is a simple game I made a while back using this concept. You can see that the wall gets closer, you have to scale the sprite up, otherwise, it wouldn't appear to get any closer.


* missile demo.gif (1640.96 KB, 192x128 - viewed 152 times.)
Logged

zStart v1.3.012 6-10-2013  zStart fully works on 83+BE's (except custom font)
All of my utilities
TI-Connect Help
You can build a statue out of either 1'x1' blocks or 12'x12' blocks. The 1'x1' blocks will take a lot longer, but the final product is worth it.
       -Runer112
graphmastur
King Graphmastur
LV11 Super Veteran (Next: 3000)
***********
Offline Offline

Gender: Male
Last Login: 02 February, 2013, 08:34:45
Date Registered: 03 June, 2010, 21:15:55
Posts: 2262


Total Post Ratings: +60

View Profile
« Reply #16 on: 14 June, 2011, 21:34:05 »
0

Do you have any axe code or something to demonstrate this principle? Maybe pretty pictures so my mind can understand it?
Logged

ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #17 on: 14 June, 2011, 21:38:19 »
0

He gave pictures in his previous post.
Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 07:46:38
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5645


Total Post Ratings: +589

View Profile
« Reply #18 on: 14 June, 2011, 21:52:28 »
+1

Here is the website I was talking about earlier, it works completely of the screen coordinates of the triangle, and uses a method called linear interpolation.  It also works in scanlines, which is beneficial to us calculator users since scanlines are special for our screen and can be drawn rather quickly. 

http://www-users.mat.uni.torun.pl/~wrona/3d_tutor/tri_fillers.html
Logged

ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #19 on: 14 June, 2011, 21:54:15 »
0

Here is the website I was talking about earlier, it works completely of the screen coordinates of the triangle, and uses a method called linear interpolation.  It also works in scanlines, which is beneficial to us calculator users since scanlines are special for our screen and can be drawn rather quickly. 

http://www-users.mat.uni.torun.pl/~wrona/3d_tutor/tri_fillers.html
Are you sure that's the right URL? I got the 'server not found' error
Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
Builderboy
Physics Guru
LV13 Extreme Addict (Next: 9001)
*************
Offline Offline

Gender: Male
Last Login: Today at 07:46:38
Date Registered: 20 April, 2009, 00:28:53
Location: Ravenholm
Posts: 5645


Total Post Ratings: +589

View Profile
« Reply #20 on: 14 June, 2011, 21:56:41 »
0

it works for me o.O

I've uploaded the file itself just in case

EDIT: Aw it didn't save the images Undecided

* Triangle fillers.htm (12.6 KB - downloaded 174 times.)
« Last Edit: 14 June, 2011, 22:03:14 by Builderboy » Logged

ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #21 on: 14 June, 2011, 22:04:20 »
0

Yes, now it works.

Thanks, this is really useful. I'll save that link, and this will be the first thing I'm going to code tomorrow. Today, I haven't got enough time left.
Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #22 on: 15 June, 2011, 21:47:36 »
0

I've already tried the solid triangle code on my computer. Works perfectely

Now I'l try the textured triangle
Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 06:43:12
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3146


Total Post Ratings: +120

View Profile
« Reply #23 on: 16 June, 2011, 13:54:25 »
0

Congrats on that. Could you post screenies when you finish the tex draw routine?
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
calc84maniac
Epic z80 roflpwner
Coder Of Tomorrow
LV11 Super Veteran (Next: 3000)
*
Offline Offline

Gender: Male
Last Login: Today at 06:30:47
Date Registered: 28 August, 2008, 05:09:05
Location: Right behind you.
Posts: 2738


Total Post Ratings: +376

View Profile
« Reply #24 on: 16 June, 2011, 16:15:06 »
0

Also a good read: http://en.wikipedia.org/wiki/Texture_mapping#Perspective_correctness
Logged

"Most people ask, 'What does a thing do?' Hackers ask, 'What can I make it do?'" - Pablos Holman
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 06:43:12
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3146


Total Post Ratings: +120

View Profile
« Reply #25 on: 16 June, 2011, 16:15:30 »
0

Also, that raycasting tutorial is great.
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #26 on: 16 June, 2011, 20:58:27 »
0

Congrats on that. Could you post screenies when you finish the tex draw routine?
Sure, but right now, I'm still trying to do it in a computer language. It's so much easier to first try it in a programming language you know, and then port it.

EDIT:I think I need some help with the textures: They just aren't being mapped correctly:

the texture itself is drawn at the right. The part that's inside the white triangle should be projected onto the triangle, while my code just pushed the whole texture in the triangle.
« Last Edit: 16 June, 2011, 22:06:52 by ben_g » Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #27 on: 17 June, 2011, 19:51:03 »
0

bad news: I think I'm going to stop with textures:I just can't get it right on my computer, and i noticed this:
Quote
Note! I find it hard to get good results using fixed point math because of inadequate precision
But that's not the main problem. The main problem is that I think that it would be way to slow. The normal triangle is fast enough, but on my computer, with 2.8GHz CPU, It takes over 5 secounds to draw the textured triangle. I know that game maker is very slow, but i don't think it's speed can be beaten by a calculator. A game just won't be fun when you have to wait for half an hour for each frame.

I think I'm going to make a 3D engine with solid faces, no textures. Unless somebody here knows how to beat the speed of a computer with a calc. (or is GM just way to slow to compare it to?)
« Last Edit: 17 June, 2011, 19:54:03 by ben_g » Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
aeTIos
You got stair'd!
LV12 Extreme Poster (Next: 5000)
************
Offline Offline

Gender: Male
Last Login: Today at 06:43:12
Date Registered: 15 September, 2010, 06:00:00
Location: Netherlands, Overijssel
Posts: 3146


Total Post Ratings: +120

View Profile
« Reply #28 on: 17 June, 2011, 19:53:41 »
0

lol, you're right. Too bad.
Logged

If something above sounds rude, feel free to vote it down, it was not meant to be rude<<lolol
--Always stay relAXEd!--


Spoiler for Hidden:


[







Spoiler for Still Alive:
This was a triumph.
I'm making a note here: HUGE SUCCESS.
It's hard to overstate my satisfaction.

Aperture Science:
We do what we must because we can.
For the good of all of us
Except the ones who are dead.

But there's no sense crying over every mistake
You just keep on trying till you run out of cake
And the science gets done and you make a neat gun
For the people who are still alive.

I'm not even angry.
I'm being so sincere right now.
Even though you broke my heart and killed me.
And tore me to pieces.
And threw every piece into a fire.
As they burned it hurt because
I was so happy for you.

Now these points of data make a beautiful line
And we're out of beta we're releasing on time.
So I'm GLaD I got burned think of all the things we learned
For the people who are still alive.

Go ahead and leave me.
I think I prefer to stay inside.
Maybe you'll find someone else to help you.
Maybe Black Mesa -
THAT WAS A JOKE. HA HA, FAT CHANCE.
Anyway, this cake is great:
It's so delicious and moist.

Look at me still talking when there's science to do.
When I look out there it makes me GLaD I'm not you.
I've experiments to run there is research to be done
On the people who are still alive

And believe me I am still alive.
I'm doing science and I'm still alive.
I feel FANTASTIC and I'm still alive.
While you're dying I'll be still alive.
And when you're dead I will be still alive.

Still alive
Still alive
ben_g
LV7 Elite (Next: 700)
*******
Offline Offline

Gender: Male
Last Login: Yesterday at 22:23:54
Date Registered: 08 May, 2011, 21:03:27
Location: (ix+$43)
Posts: 674


Topic starter
Total Post Ratings: +85

View Profile
« Reply #29 on: 17 June, 2011, 20:33:23 »
0

this can be caused by 2 different things: the algorithm is very inefissient, or Game Maker is very bad at drawing. There should be some way to efficiently draw triangles

btw: I just tested GM's drawing speed, and it turns out that drawing points with gm is really slow. Could there still be a chance that this is possible? I mean: OpenGL can render over a milion textured triangles with over 2000 fps. But openGL uses the graphics card, and a calculator hasn't got a good graphics card. Is there a chance that i could get reasonable speeds with this, or should i just give up?
Logged

Spoiler for completely unimportant stuff:
My projects
 - A base converter that also supports signed and fixed-point numbers.
 - A first person shooter with a polygon-based 3d engine.
Spoiler for latest screenshot:
- A java MORPG.
Spoiler for screenshot:
- a minecraft game in axe
Spoiler for Only open this spoiler if you want to read what's inside:
What's inside.
From when I saw this image, I never lost the game again!
Spoiler for This is [Edit:
not[/Edit] my contest entry. I hope you like it.]
Pages: 1 [2] 3 4 ... 7   Go Up
  Print  
 
Jump to:  

Powered by EzPortal
Powered by MySQL Powered by SMF 1.1.18 | SMF © 2013, Simple Machines Powered by PHP
Page created in 0.497 seconds with 31 queries.
Skin by DJ Omnimaga edited from SMF default theme with the help of tr1p1ea.
All programs, games and songs avaliable on this website are property of their respective owners.
Best viewed in Opera, Firefox, Chrome and Safari with a resolution of 1024x768 or above.