Files |  Tutorials |  Articles |  Links |  Home |  Team |  Forum |  Wiki |  Impressum

Aktuelle Zeit: Di Jul 08, 2025 08:50

Foren-Übersicht » English » English Programming Forum
Unbeantwortete Themen | Aktive Themen



Ein neues Thema erstellen Auf das Thema antworten  [ 22 Beiträge ]  Gehe zu Seite Vorherige  1, 2
Autor Nachricht
 Betreff des Beitrags:
BeitragVerfasst: Fr Apr 11, 2008 18:14 
Offline
DGL Member
Benutzeravatar

Registriert: Do Sep 02, 2004 19:42
Beiträge: 4158
Programmiersprache: FreePascal, C++
I think depth-shading is the wrong term, but in the tutorial you mentioned I have seen some hints in this direction in the second part.

Greetings Lord Horazont

_________________
If you find any deadlinks, please send me a notification – Wenn du tote Links findest, sende mir eine Benachrichtigung.
current projects: ManiacLab; aioxmpp
zombofant networkmy photostream
„Writing code is like writing poetry“ - source unknown


„Give a man a fish, and you feed him for a day. Teach a man to fish and you feed him for a lifetime. “ ~ A Chinese Proverb


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Fr Apr 11, 2008 21:21 
Offline
DGL Member
Benutzeravatar

Registriert: Di Okt 03, 2006 14:07
Beiträge: 1277
Wohnort: Wien
@Stucuk: You can visit Paul Bourke's websites for further information.

Using a cubemap was not my idea. You said you cannot get the uv values for the cubemap and I told you how it is calculated on the mentioned website. I told you that it is possible to put your texture without having a singularity on a half sphere calculating the texture coords by yourself. Yes I could find out the algo, but why should I? It was not really funny to help you so far.


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Apr 12, 2008 01:31 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Traude hat geschrieben:
Using a cubemap was not my idea. You said you cannot get the uv values for the cubemap and I told you how it is calculated on the mentioned website.


Well unfortunatly It doesn't seem to work. I may have implemented it incorrectly:

Code:
  1. var
  2.  N : TVector3f;
  3. begin
  4.  case Mode of
  5.   1 : begin N[0] := x*2-1; N[1] := y*2-1; N[2] := -1; end;
  6.   2 : begin N[0] := 1;  N[1] := y*2-1; N[2] := x*2-1; end;
  7.   3 : begin N[0] := -1; N[1] := y*2-1; N[2] := x*2-1; end;
  8.   4 : begin N[0] := x*2-1; N[1] := 1; N[2] := y*2-1; end;
  9.   5 : begin N[0] := x*2-1; N[1] := -1; N[2] := y*2-1; end;
  10.   else
  11.   begin N[0] := x*2-1; N[1] := y*2-1; N[2] := 1; end;
  12.  end;
  13.  AddTriIndex(AddGlobalPoint(N[0],N[1],N[2]));
  14.  case mode of
  15.   0 : begin x := N[0]; y := 1-N[1]; end;
  16.   1 : begin x := N[0]; y := N[1]; end;
  17.   2 : begin x := 1-N[2]; y := 1-N[1]; end;
  18.   3 : begin x := N[2]; y := N[1]; end;
  19.   4 : begin x := N[0]; y := N[2]; end;
  20.   5 : begin x := N[0]; y := 1-N[2]; end;
  21.  end;
  22.  FTextureCoords[FTIndex-1][0] := x;
  23.  FTextureCoords[FTIndex-1][1] := y;


Zitat:
I told you that it is possible to put your texture without having a singularity on a half sphere calculating the texture coords by yourself.

Yes but i can't find anything useful online. Iv tryed This and this but i can't get eather to work perfect.

Zitat:
Yes I could find out the algo, but why should I?

I havn't demanded anything, i have only asked how to generate the sphere texture coords as you seem to know. Iv searched and ill continue to search online on how to generate proper texture coordinates. Im not afraid of doing hard work, i just literaly have no clue how the hell you generate sphere coordinates which don't get screwed up at the poles. Which is why i asked in the first post if anyone knew how to generate good tex coords.

Zitat:
It was not really funny to help you so far.

If you don't wish to try and help then you don't have to. Thx for trying.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Apr 12, 2008 08:50 
Offline
DGL Member
Benutzeravatar

Registriert: Di Okt 03, 2006 14:07
Beiträge: 1277
Wohnort: Wien
Hallo Stucuk,
from my point of view the following has happened: I took my time taking snapshots and making explanations. These were no short answers to your question, alltogether it sure lasted at least one hour or more. And what did I get? Only a :P .... I don't like to be teased.

Yes I know how to do such things because i am writing a modeller and the part of assigning textures planar, cylindrical and spherical is already finished. It is only a hobby project and I do it because I want to know how things really work. Therefore I do it the hard way: no glu-code allowed, no glTranslate/Rotate/Scale only self made matrices etc.

Concerning the cube map: If I would need a sky I would take a sphere too because you do not need six textures or a panoramic view with special texture coordinates or such things. One texture is enough and that is important if you want to use the texture matrix, for example. It makes everything much easier.

If you are patient enough to wait until tomorrow morning I setup a small windows program where the code concentrates on the interesting things. I make it just the other way round the guy in this article did: I start from the sphere vertex, shoot it on a plane and then shift and scale it to texture space. There is no singularity on the top because in this case the texture is not wrapped around the sphere but put ON the half sphere like a blanket.

Note: you mentioned you want to have it proper. This needs a better definition. You are putting a plane onto a sphere. that means, you will never get it "proper", because stretching cannot be avoided, only be made less ugly.

By the way, there is no reason why the code of the article should not work. If you want me to, I take the code of this article and the cube map. But I would take only one texture for all six sides.

It takes a little bit because all the necessary code is core modellercode and I have to draw it out and arrange it new for you. I cannot do that before evening - a nice saturday night's work. Will I get another :P ...?
Traude


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Sa Apr 12, 2008 18:30 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Traude hat geschrieben:
Only a :P .... I don't like to be teased.


Didn't mean to make it sound as if i was teasing.

Zitat:
If you are patient enough to wait until tomorrow morning I setup a small windows program where the code concentrates on the interesting things. I make it just the other way round the guy in this article did: I start from the sphere vertex, shoot it on a plane and then shift and scale it to texture space. There is no singularity on the top because in this case the texture is not wrapped around the sphere but put ON the half sphere like a blanket.

That would be great, thanks.

Zitat:
Note: you mentioned you want to have it proper. This needs a better definition. You are putting a plane onto a sphere. that means, you will never get it "proper", because stretching cannot be avoided, only be made less ugly.


By proper i mean so that if you set it up in a FPS game that it would look to the player like a sky with no apparent anomolies which jump out at you (Your blanket method looks good).

Zitat:
By the way, there is no reason why the code of the article should not work. If you want me to, I take the code of this article and the cube map. But I would take only one texture for all six sides.

Could be that im implementing it wrongly, Tho with normal cube texture coordinates i don't see how you can get 1 texture to be properly displayed on a "CubeSphere" as it is displaying 1 texture(0,0 -> 1,1) for each of the 6 cube face's rather than 1 texture over the whole object.

Zitat:
Will I get another :P ...?

Nope you get a :D. I am extremely greatful to everyone that replys.

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Mo Apr 14, 2008 07:55 
Offline
DGL Member
Benutzeravatar

Registriert: Di Okt 03, 2006 14:07
Beiträge: 1277
Wohnort: Wien
Hallo Stucuk,
Sorry that I'm late but I had to struggle a little bit with glFrustum (I always struggle with glFrustum, whenever I get my hands on it).

I add below a delphi example program that uses a "skydome", a magnificant name for a really simple inner half sphere with texture coordinates that have no singularity at the top. It is "standing" on the X/Z plane. I hope I succeded in making the code understandable.

My modeller code was not suitable because it uses the classic way of creating sphere tex coords. It is also not recommendable to just orthogonal project the vertices to the X/Z-plane, because the texture would "brake down" at the margin of the half sphere, as someone somewhere mentioned. So I changed the method of calculating the tex coords a little bit (for details see code). But I want to point out that this is neither the best nor the only way of getting good sphere tex coords. There is plenty of space for improvement (making the dome a little bit flatter, reducing distortion, ...)

You need dglOpenGL.pas and glBitmap.pas for compilation.

*** Use the mousewheel to go up and down in the dome (the dome is rotating)
*** Press the "Toggle"-button to change between looking up/looking forward
*** If you want to change the texture: take a look into TestFormUnit.pas, line 89.
Traude


Dateianhänge:
SkyDomeTest.zip [5.44 KiB]
308-mal heruntergeladen
Nach oben
 Profil  
Mit Zitat antworten  
 Betreff des Beitrags:
BeitragVerfasst: Di Apr 15, 2008 00:55 
Offline
DGL Member
Benutzeravatar

Registriert: Mi Jul 21, 2004 22:39
Beiträge: 360
Wohnort: UK, Scotland
Bild

Thanks. Iv replaced the dome in the dynamic clouds demo with your one (and given credit in readme + SkyDome unit). It seems to work perfectly :D (I can't find any anomolies anyway).

- Download ~327KB

_________________
Free Map Editor - Game Requirements - Stucuk.Net
-Stu


Nach oben
 Profil  
Mit Zitat antworten  
Beiträge der letzten Zeit anzeigen:  Sortiere nach  
Ein neues Thema erstellen Auf das Thema antworten  [ 22 Beiträge ]  Gehe zu Seite Vorherige  1, 2
Foren-Übersicht » English » English Programming Forum


Wer ist online?

Mitglieder in diesem Forum: 0 Mitglieder und 1 Gast


Du darfst keine neuen Themen in diesem Forum erstellen.
Du darfst keine Antworten zu Themen in diesem Forum erstellen.
Du darfst deine Beiträge in diesem Forum nicht ändern.
Du darfst deine Beiträge in diesem Forum nicht löschen.
Du darfst keine Dateianhänge in diesem Forum erstellen.

Suche nach:
Gehe zu:  
  Powered by phpBB® Forum Software © phpBB Group
Deutsche Übersetzung durch phpBB.de
[ Time : 0.009s | 15 Queries | GZIP : On ]