QJ.NET | Videos | Forums | iPhone | MMORPG | Nintendo DS | Wii | PlayStation 3 | PSP | Xbox 360 | PC | Downloads | Contact Us
Forums | Gaming News | Videos | Downloads | Today's Posts | Mark Forums Read | Chat | FAQ | Members List | Contact

QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides

Go Back   QJ.net Game Discussion - PSP, Xbox, Wii, PS3, PSP Homebrew, and PSP Guides > Developers Corner > PSP Development, Hacks, and Homebrew > PSP Development Forum
The above video goes away if you are a member and logged in, so log in now!

Wrapping textures around 3D models in Lua.

This is a discussion on Wrapping textures around 3D models in Lua. within the PSP Development Forum forums, part of the PSP Development, Hacks, and Homebrew category; How do you do it? O_o...

Reply
 
LinkBack Thread Tools
Old 02-14-2007, 09:21 PM   #1
 

 
Join Date: Aug 2006
Location: Missouri
Posts: 451
Trader Feedback: 0
Default Wrapping textures around 3D models in Lua.

How do you do it? O_o
Cheez Pirate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-14-2007, 09:37 PM   #2

PSP Developer
 
alatnet's Avatar
 
Join Date: Oct 2005
Real First Name: Alex
Location: ~* Confidential *~
Just Played: N/A
Posts: 839
Trader Feedback: 0
Default

That will be implemented in Luaplayer 0.20 Mod 4 by cools and me (well me helping out).
Along with extra useful 3D, Wlan, and Misc functions that enhance luaplayer's capabilities.
Also, the function for c\c++ for wrapping an image around a 3D model is:
Code:
/**
  * Set if the texture should repeat or clamp
  *
  * Available modes are:
  *   - GU_REPEAT - The texture repeats after crossing the border
  *   - GU_CLAMP - Texture clamps at the border
  *
  * @param u - Wrap-mode for the U direction
  * @param v - Wrap-mode for the V direction
**/
void sceGuTexWrap(int u, int v);
I do not know wether this just wraps an image to a single pair of triangles (e.g. a square) or the whole model itself.
It may require some experimentation for this to be confirmed.
__________________

"Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder."-me
Anime/Manga and Fanfiction is my inspiration!

Creator of:
- PSPSDK makefile creator - Lua Prompt - Animated Sprite Class\Library for Lua - Gmax2PSP -
alatnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-14-2007, 09:49 PM   #3
 

 
Join Date: Aug 2006
Location: Missouri
Posts: 451
Trader Feedback: 0
Default

Good luck with it.
Cheez Pirate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-14-2007, 09:55 PM   #4

PSP Developer
 
alatnet's Avatar
 
Join Date: Oct 2005
Real First Name: Alex
Location: ~* Confidential *~
Just Played: N/A
Posts: 839
Trader Feedback: 0
Default

Heh, no prob.
It's just that doing two things at once is the hard part.
Me helping out with Mod 4 while I'm trying to get my MMO game up and running.
PSP connecting to a Java Server sort of works, need to debug the communications cus im having probs with the server responding/sending data.
Then comes the database stuff. And finaly comes the interesting psp2psp communications part.
__________________

"Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder."-me
Anime/Manga and Fanfiction is my inspiration!

Creator of:
- PSPSDK makefile creator - Lua Prompt - Animated Sprite Class\Library for Lua - Gmax2PSP -
alatnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-14-2007, 09:56 PM   #5

Developer in Making...
 
BlackShark's Avatar
 
Join Date: Oct 2006
Location: Pimp'en in the US F#cking A!!!
Posts: 1,254
Trader Feedback: 0
Default

Quote:
Originally Posted by alatnet
That will be implemented in Luaplayer 0.20 Mod 4 by cools and me (well me helping out).
Along with extra useful 3D, Wlan, and Misc functions that enhance luaplayer's capabilities.
Also, the function for c\c++ for wrapping an image around a 3D model is:
Code:
/**
  * Set if the texture should repeat or clamp
  *
  * Available modes are:
  *   - GU_REPEAT - The texture repeats after crossing the border
  *   - GU_CLAMP - Texture clamps at the border
  *
  * @param u - Wrap-mode for the U direction
  * @param v - Wrap-mode for the V direction
**/
void sceGuTexWrap(int u, int v);
I do not know wether this just wraps an image to a single pair of triangles (e.g. a square) or the whole model itself.
It may require some experimentation for this to be confirmed.

cool, good luck with lua player mod 4, you and Cool's
__________________
The Wentire Worls in two Sectors....
When did I get dev statz?
Spoiler for my PSP homebrewReleases:
Ace of Space V1|PvP Pong Online|PvP Pong v3 | 3.03 BlackShark Custom Firmware
(PvP Pong DL'ed well over 2403 times combined! get yours now!)
Spoiler for Great Quotes:

"No Snowflake in an Avalanche ever feels responsible....." - Fortune Cookie.
BlackShark is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-14-2007, 10:03 PM   #6
 

 
Join Date: Aug 2006
Location: Missouri
Posts: 451
Trader Feedback: 0
Default

Quote:
Originally Posted by alatnet
Heh, no prob.
It's just that doing two things at once is the hard part.
Me helping out with Mod 4 while I'm trying to get my MMO game up and running.
PSP connecting to a Java Server sort of works, need to debug the communications cus im having probs with the server responding/sending data.
Then comes the database stuff. And finaly comes the interesting psp2psp communications part.
Are you coding your MMO in Lua or C/C++? And is it 3D? O_o
Cheez Pirate is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-14-2007, 11:46 PM   #7

...in a dream...
 
SG57's Avatar
 
Join Date: Jul 2005
Posts: 4,957
Trader Feedback: 0
Default

http://wiki.ps2dev.org/psp:lua_player:functions

Quote:
Gu.start3d() saves the current GE state for the normal 2D operations. Call this function first and then draw your scene. You can use the following functions:

Gu.clearColor, Gu.clearDepth, Gu.clear, Gum.matrixMode, Gum.loadIdentity, Gum.perspective, Gum.translate, Gum.rotateXYZ, Gu.texImage, Gu.texFunc, Gu.texEnvColor, Gu.texFilter, Gu.texScale, Gu.texOffset, Gu.ambientColor, Gu.enable, Gu.disable, Gu.blendFunc, Gu.light, Gu.lightAtt, Gu.lightColor, Gu.lightMode, Gu.lightSpot and Gum.drawArray. See the PSPSDK for documenation about the parameters, for example the pspgu.h. If there is a ScePspFVector3, write 3 numbers instead one parameter (this will be changed in a later version). Whereever a color is expected, use a Color object. For textures use an Image object.

Gum.drawArray is something special: It has just 3 parameters: “prim”, “vtype” and a table. With “prim” you specify which primitive should be used, for example Gu.TRIANGLES. “vtype” specifies the vertex format and the transformation operation. For example “Gu.COLOR_8888|Gu.VERTEX_ 32BITF|Gu.TRANSFORM_3D” means, that your vertices has a color component and a 3 vertex coordinate components and is transformed before passed to the rasterizer. The table is then a list of vertex entries, where each vertex entry has the form (color, x, y, z). If you have specified GU_TEXTURE_32BITF, too, then one entry looks like this: (textureU, textureV, color, x, y, z). The order of the entries is defined in pspgu.h: textureU, textureV, color, normalX, normalY, normalZ, vertexX, vertexY, vertexZ. Indices, weights and multiple vertices per entry (which you’ll need for the morphing feature) currently are not supported.

After drawing anything, call Gu.end3d(), which flushs the display buffer and draws all pending 3D graphics and restores the 2D GE state. Don’t forget to call a screen:clear() before fullscreen 2D operations, because otherwise the z-buffer is not cleared and the blitting functions may not work correctly. If you need to blit 2D images in 3D mode, use textures and triangles.

See the 3D Cube example in the Applications folder of the distribution of Lua Player to see how to use the 3D functions and take a look at the GU example in the PSPSDK how to use all the other functions. Most of the time you can copy and paste the examples and just remove all those C fussinesses like “.0f”, semicolon, malloc etc. :-)
Look at the example that comes with lua player as well. Also, the functions i bolded, you should be able to look at a C source file that uses the GU and maps a texture onto a set of verticies.
__________________
SG57 is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-15-2007, 11:06 AM   #8

PSP Developer
 
alatnet's Avatar
 
Join Date: Oct 2005
Real First Name: Alex
Location: ~* Confidential *~
Just Played: N/A
Posts: 839
Trader Feedback: 0
Default

Quote:
Originally Posted by Cheez Pirate
Are you coding your MMO in Lua or C/C++? And is it 3D? O_o
I'm codeing it in Java (PC Side Server), PHP and MySql (Remote Database on a webhost), and Lua with posible C\C++ to expand Lua functionality (PSP Game).

It's going to use 3D levels or arenas with 2D playable characters (heh 2.5D).
There's also going to be an RPG aspect to it too!

I might need some slight help with the sprites and maybe coding it a bit, but no one may understand the way I code stuff.

I still need to work on the server. After that I going to work on the PHP and MySql databaseing stuff. Finaly I'll work on PSP2PSP connectivity. All while coding the actual game.

I figured out how to handle all of the connections and what not, TCP will be used for server and database communications while UDP will be used for PSP2PSP communications as it seems to be better at handling intensive communications.

This may somehow spawn a PSP P2P program out of it, I dono.

After I deem that everything is complete, I'll release a beta and have updates for it every now and then that will add new features, characters, levels/arenas, skills, and/or items. Which can be downloaded via PC or PSP.

It was originaly going to be called ALMMO (Angelic Layer MMO), but I desided to change the name to Ultimate Battle RPG, though this may not be the permanant name, I'm open to suggestions for a better name.

Quote:
Originally Posted by SG57
http://wiki.ps2dev.org/psp:lua_player:functions


Look at the example that comes with lua player as well. Also, the functions i bolded, you should be able to look at a C source file that uses the GU and maps a texture onto a set of verticies.
There are some functions in the C\C++ version of the PSP's GU functions that are not implemented in luaplayer.
__________________

"Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder."-me
Anime/Manga and Fanfiction is my inspiration!

Creator of:
- PSPSDK makefile creator - Lua Prompt - Animated Sprite Class\Library for Lua - Gmax2PSP -
alatnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-16-2007, 03:42 AM   #9
 
blah's Avatar
 
Join Date: Jun 2005
Posts: 125
Trader Feedback: 0
Default

hey man.. ive already modded lua player with that function if you want it?

ive added..

Gu.texScale,Gu.offset,Gu. veiwPort,Gu.scissor,Gum.o rtho,Gum.scale,Gum.lookAt ,Gu.frontFace...

Last edited by blah; 02-16-2007 at 04:00 AM..
blah is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-16-2007, 06:20 AM   #10

PSP Developer
 
alatnet's Avatar
 
Join Date: Oct 2005
Real First Name: Alex
Location: ~* Confidential *~
Just Played: N/A
Posts: 839
Trader Feedback: 0
Default

Why not give some of those functions to cools?
__________________

"Every team needs an idealistic person (whether they are a noob or a pro), my team doesn't have one cus im the idealistic founder."-me
Anime/Manga and Fanfiction is my inspiration!

Creator of:
- PSPSDK makefile creator - Lua Prompt - Animated Sprite Class\Library for Lua - Gmax2PSP -
alatnet is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Old 02-16-2007, 08:43 AM   #11

Developer
 
cools's Avatar
 
Join Date: Aug 2005
Posts: 472
Trader Feedback: 0
Default

I'd be glad to add those functions in! Just pm me the code!
__________________

PSP Monopoly | PSP Tic Tac Toe | PSP eMail and SMS | Drag Mini | Block Dude
http://www.cools.biaklan.com
Currently Working on ?????

Quote of the Week
cools is offline  
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiFurl this Post!
Reply With Quote
Reply

Tags
lua , models , textures , wrapping

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off



All times are GMT -8. The time now is 09:01 PM.



Use of this Web site constitutes acceptance of the TERMS & CONDITIONS and PRIVACY POLICY
Copyright © 2009, QJ.NET. All Rights Reserved.
Contact Us