Crystal Space
Welcome, Guest. Please login or register.
April 20, 2015, 02:13:00 am

Login with username, password and session length
Search:     Advanced search
9035 Posts in 2050 Topics by 9782 Members
Latest Member: Tompor598
* Home Help Search Login Register
  Show Posts
Pages: 1 2 [3] 4 5
31  Crystal Space Development / Support / Renderloop questions on: June 25, 2007, 09:38:21 am
In order to understand the renderloops i have several questions

Each renderloop step uses a specific plugin. Browsing through the renderloop files i could find the following:


 and maybe some others

When & how  do i have to use a specific renderloop?
For example: if i use the "standard" renderloop (generic) in combination with the "standard shader". I notice that the genmeshes are dynamically lighted by only 1 light, and it seems that the most close lamp (relative to the genmesh) is choosen for this. if the range of this light (as defined in the worldfile) is smaller than the distance to the object, the mesh is not lighted at all (black).
So do i have to use a "lightiter" renderloop step in order to use more than 1 dynamic light for the genmeshes?
And in this case, how does this influence the (required) bindings in the shader?

Could someone shed some light on these issues.
Are there some examples (in either a worldfile or somewhere in the source code) that could make the renderloop usage more clear?


it is a pitty that the CS conferences are always during my holidays  sad   
I hope that the sessions will be captured on video, like last year.

32  Crystal Space Development / General Crystal Space Discussion / Re: Release of V1.0pre1! on: October 27, 2006, 09:32:13 am
Hi Jorrit
great to have a 1.0 version close in sight!
what version of the prebuilt win32 utilities libraries do you suggest, i guess the latest version (rc1)?
33  Crystal Space Development / Support / Re: nettest on: October 25, 2006, 11:10:49 pm
i noticed this behaviour from the testprogram that comes with the HawkNL package, namely with the Test_clientserver test.

The server thread of this test program polls the socketgroup with a timeout of 0
        count = nlPollGroup(group, NL_READ_STATUS, s, MAX_CLIENTS, 0);
This causes a 100% cpu load of the server thread
If the timeout is changed to e.g. 1 (specified in msec) the cpu-load will drop
        count = nlPollGroup(group, NL_READ_STATUS, s, MAX_CLIENTS, 1);

So check the CEL net-testcode for the nlPollGroup method...
34  Crystal Space Development / Support / Can't get directional sound working on: October 23, 2006, 02:01:58 pm
The soundsource is always omnidirectional, no matter how i define the sound direction and cone-angle  sad
I want to simulate a worldspace fixed directional sound.
I use one of the latest svn snapshops, compiled for WinXP
The updating of the sound is done as follows:

  csVector3 worldPos(70.0f, 20.0f, -3.3f);
  csVector3 pos = view->GetCamera ()->GetTransform ().Other2This (worldPos);
  sndsource3d->SetPosition (pos); // sndsource3d is a iSndSysSourceSoftware3D interface
  csVector3 worldDir(0.0f, 0.0f, -1.0f);
  pos = view->GetCamera ()->GetTransform ().Other2ThisRelative (worldDir);
  sndsource3d->SetDirection (pos);
  sndsource3d->SetDirectionalRadiation (3.14f/20.0f);
The position is updated properly, only the directional part does't work

Another thing i noticed is that the sound is not "muted" when the distance of the sound is larger than the distance specified with sndsource3d::SetMaximumDistance()

comment from ss_source.h:
   * Set the greatest distance from a sound at which the sound can be heard.
   * If the distance to a listener is above this threshold, it will not be
   * mixed into the output buffer at all.  This saves a tiny bit of processing.

Another comment in ss_source.h says:
   * Set the greatest distance from a sound at which the sound plays at full
   * amplitude.
   * When a listener is closer than this distance, the amplitude is the volume
   * of the sound.
   * When a listener is further than this distance, the amplitude follows the
   * formula V = (volume / ((distance/minimum_distance) ^ rolloff_factor))
  virtual void SetMinimumDistance (float distance) = 0;
This seems to work, however I can't find a method to change the rolloff_factor sad

does anyone know how to do these things right?
35  Crystal Space Development / Support / Distortion of cal3d animations on: October 19, 2006, 10:56:51 am
i'm trying to convert a set of animated character models (3dsmax) to be used with CS.

The exported models look ok when viewed with the cal3d viewer (part of the cal3d project).
So at this point I conclude that the cal3d files (model.cmf .model.csf and model.caf) are ok.

However, when the models are viewed with the CS meshview.exe application, the model looks fine in first instance (after
starting meshview). When the animation is selected and started however, the animation "distorts the mesh".

I found that this has to do by the fact that the mesh object (as seen in 3dsmax) is made op of several "elements".
So there is an element within the "mesh object" for the left arm, right arm, head etc.

When i compare it to the cally model (which is animated corectly with meshview) the difference is that the cally model consists of
a separate mesh object (and separate mesh file) for each part of the body, my model has only 1 mesh-file.

I understand that by defining the object as several meshes gives the flexibility to change the material of a part of the model.
My models are defined with 1 material for the complete mesh, so  it "should be possible" to specify only 1 mesh, 1 material,
1 skeleton file. The cal3d viewer handles it corectly. So i wonder if this "restriction" of CS has a specific reason or if it is a bug...

This has nothing to do with 3dsmax, because the exported files are correcty animated with the cal3d viewer...

Does anyone has an idea how i could use these cal3d models from CS?

btw: i had the same results with the pseudo-static release as with a recent svn snapshop version.
My platform is WinXP
36  Crystal Space Development / Support / Re: Some feedback about the PBO experiments... on: October 04, 2006, 09:53:43 am
it does!
now it all fits nice together: i don't have to modify CS code and i do have the option to choose the mipmap mode in
order to exchange quality versus download speed.
The speed gain without mipmapping is ~8 on my system, this ratio is "out of scope" for CS because the mipmap generation
is done using the automipmap extension of OpenGL.

I should have known of the CS_TEXTURE_NOMIPMAPS option before....
The "excercise" did however give me more insight into CS internals...

Thanks for pointing me to the CS_TEXTURE_NOMIPMAPS option

For those interested in the bandwith ratio's of the different texture modes i included the output of my test program.
It is executed on a Dual Xeon 1.7G with a Nvidia Quadro FX3000 (4x agp) using texture size of 1280x1024, 4 Bytes/pixel

The maximum speed using PBO's is                 0.91 GB/sec
The maximum speed using "normal textures" is 0.81 GB/sec

On PCI express systems PBO's are about twice as fast (maximum, dependent of internal/external texture format)

memory copy using memcp()
0.597411 GBytes/sec
2.34924 x AGP
2.38964 x PCI Express

Using glTexImage2D
Texture format (internal external) : GL_RGBA GL_RGBA
0.514917 GBytes/sec
2.02484 x AGP
2.05967 x PCI Express

Texture format (internal external) : GL_RGBA GL_BGRA
0.812598 GBytes/sec
3.19543 x AGP
3.25039 x PCI Express

Texture format (internal external) : GL_BGRA GL_RGBA
0.513102 GBytes/sec
2.0177 x AGP
2.05241 x PCI Express

Texture format (internal external) : GL_BGRA GL_BGRA
0.818688 GBytes/sec
3.21938 x AGP
3.27475 x PCI Express

Texture format (internal external) : GL_LUMINANCE GL_LUMINANCE
0.599049 GBytes/sec
2.35568 x AGP
2.3962 x PCI Express

Using glTexImage2D with GL_EXT_pixel_buffer_object extension
Texture format (internal external) : GL_RGBA GL_RGBA
0.29949 GBytes/sec
1.17771 x AGP
1.19796 x PCI Express

Texture format (internal external) : GL_RGBA GL_BGRA
0.915627 GBytes/sec
3.60058 x AGP
3.66251 x PCI Express

Texture format (internal external) : GL_BGRA GL_RGBA
0.299046 GBytes/sec
1.17596 x AGP
1.19619 x PCI Express

Texture format (internal external) : GL_BGRA GL_BGRA
0.911488 GBytes/sec
3.5843 x AGP
3.64595 x PCI Express

Texture format (internal external) : GL_LUMINANCE GL_LUMINANCE
0.77283 GBytes/sec
3.03905 x AGP
3.09132 x PCI Express

37  Crystal Space Development / Support / Some feedback about the PBO experiments... on: October 03, 2006, 11:11:15 am
In order to speed up the dynamical texture uploads i implemented a PBO-version of the TextureHandle class.
I was surprised that i did not got any speed improvement, so made a testprogram (using only glut and
OpenGL libraries) to measure the texture download speeds.
It turned out that even the "normal" textures can be uploaded with around 500 MB/sec (on my 4xAGP system),
which is much faster than what i could measure from my CS application (in the TextureHandle::Blit() routine).
After looking again at the code, it turned out that


was the reason for the slow download speed: the automatic generation of the mipmaps completely crippled the
performance. As a first attempt i uncommented this line which improves the download speed by a factor of ~ 10.
I use this as my "default" for now, it would be better although to be able to use a selective aproach instead of hardcoded....

I included a picture of the CS application which shows the "videowall" with the vnc-connection to a remote PC.
By transforming the mouse coordinates to the object space of the video-wall polygon i can send the correct
mouse-events to the vnc-client to control remote desktop. On the remote PC i started a "plain" vnc client that
connects back to  the PC that runs the CS application.  The feedback loop causes the infinite recursion that causes the
"dual mirror effect". Although not a really useful setup it results in a nice picture...


38  Crystal Space Development / Support / Re: Problem with PlaneShift Exporter in 3DS MAX 8 on: September 18, 2006, 02:28:06 pm
another attention point:
you used
as start of the filepath. As far as i checked, the pathname cannot contains spaces, if it does, you also get the error message

39  Crystal Space Development / Support / Re: Problem with PlaneShift Exporter in 3DS MAX 8 on: September 18, 2006, 01:19:43 pm
It lookst that file that you specified cannot be opened for writing.
Check your path (that it exists) and that you are allowed to write the in the specified directory
40  Crystal Space Development / Support / Re: PBO's in CS? on: September 15, 2006, 08:30:32 pm
Sounds good!
Next week I will start with an implementation of the 2 functions
The interface would be iTextureHandle. The methods would look like:
virtual uint8* GetBlitBuffer(size_t size) = 0;
virtual void DiscardBlitBuffer(uint8* buffer) = 0;
The only thing I have to find out is where to query/activate for the PBO-extension. As far as I can see the constructor
of csGLTextureManager is a suitable place:

  G3D->ext->InitGL_ARB_pixel_buffer_object ();
  if (G3D->ext->CS_GL_ARB_pixel_buffer_object)
    G3D->ext->InitGL_pixel_buffer_object ();

many thanks,
41  Crystal Space Development / Support / Re: PBO's in CS? on: September 15, 2006, 04:09:26 pm
i guess you are referring to the suggestion from the ticket:

>> To avoid blocking rendering when procedural textures are used, support a kind of "async" upload would be nice.
>> It probably means that two memory buffers for the pixel data would be needed, one that is uploaded, and one that is changed.
>> Interface-wise, dfryer suggested to add a method to query a buffer that can be filled with pixel buffer, and passing it to Blit() later
>> signals that the modification is complete. Implementation-wise, the APPLE_client_storage and EXT_pixel_buffer_object extensions
>> could be utilized

What would be interface to add the mentioned function?
I guess not the iTexture interface because it should not contain implementation specific methods.

So it could be added it to the csGLTexHandle interface. The application could then <dynamic_cast> the iTexture pointer
(as returned from  engine->CreateBlackTexture("videoTexture", 2048, 1024, 0, CS_TEXTURE_3D); )
to a csGLTextureHandle pointer. At least this would be a type-safe way.

The new functions would then be:

char* csGLTexHandle::getImage(void); // Returns pointer of mapped PBO
char* csGLTexHandle::Blit(...);             // New blit function specific for PBO's


42  Crystal Space Development / Support / Re: PBO's in CS? on: September 15, 2006, 12:29:07 pm
Ok, this is what i'm thinking of now

// Implementation 1, not so nice...

// From application setup create texture as usual:

iTextureWrapper  g_videoTexture = engine->CreateBlackTexture("videoTexture", 2048, 1024, 0, CS_TEXTURE_3D); 

// Now instantiate a csPBOimageMemory object which is a PBO implementation of the  csImageBase
// It will create 2 PBO's so the image could be used by glTexSubImage() and the application simultanuously (this
// is important if the "upload" by the application runs on another thread than the drawing thread.)

 csimageMemoryPBO* img = new csimageMemoryPBO(2048, 1024);

 g_videoTexture->SetImageFile(img);   // Connect to the texture

// Single thread example of CS frame  processing:

processFrame() {

  char* p = img->getImage();   // This will glMap 1 of the 2 PBO's and return the pointer so the application can store the
                                            // new image for this frame. The other PBO will be glUnmapped, so it can be used by
                                            // glTexSubimage() in the Blit() funtion of the texture.
  defineNewImage(p);             // Here the application updates the new Frame

  // Update the texture
  g_videoTexture->GetTextureHandle()->Blit(0, 0, 1280, 1024, 0);  // g_txtmgr.cpp has to be changed such that the blit function
                                                                                               // interpretes the null pointer as "use PBO as source".
                                                                                               // As such it will  glBind() the unmapped PBO,
                                                                                               // so glTexSubImage will use the PBO to upload the texture

A nicer approch would be to define a new texture class for this purpose.
In that case the engine interface must be extended. The application can then call something like

// Implementation 2, nicer...

iTextureWrapper  g_videoTexture = engine->CreatePBOtexture("videoTexture", 2048, 1024, 0, CS_TEXTURE_3D); 
// Single thread example

processFrame() {

  char* p = g_videoTexture->GetImage()->getImageData();


  g_videoTexture->GetTextureHandle()->Blit(0, 0, 1280, 1024); 

For multithreaded use, the glTexSubImage must be protected with a semaphore.
The glMap() and glUnmap()  funtions in g_videoTexture->GetImage()->getImageData() must also be protected.

There are other issues like signalling. The described implementation updates every frame which is fine for me now.
More in general updating should only be done when needed.
I don't know yet if i the  iEventHandler class could be used as another base class for the PBOtexture in order to do the uploading
in an event driven way.

43  Crystal Space Development / Support / PBO's in CS? on: September 14, 2006, 04:21:06 pm
I'm using the Texture::Blit() function to upload a texture each frame. This works fine, however it seriously impacts the framerate
( texture size = 2048x1024 )
PBO's (ARB_pixel_buffer_object OpenGL extension) would speed up the upload considerably.

Is there support for PBO's? As fas as i can see they are not supported.

In that case I'm considering changing the texture code to support PBO's (as far as i can see this is mainly involves gl_txtmgr.cpp)

44  Crystal Space Development / Support / Re: Changing object state (texture) after having loaded it on: September 12, 2006, 08:57:07 am
I changed the object type to genmesh, now things are OK
Many thanks!
45  Crystal Space Development / Support / Changing object state (texture) after having loaded it on: September 11, 2006, 04:08:20 pm
The manuals and examples are not clear about about the responsabilities of the involved objects, so i tried several approaches without

// After having loaded the map file:

1: Create new texture:

    iTextureWrapper* videoTexture = engine->CreateBlackTexture("videoTexture", 256, 256, 0, CS_TEXTURE_3D);

2: Create memory, use it to initialise the texture:

    csImageMemory* img = new csImageMemory(256, 256);
    csRGBpixel px(255,255,255);

3: Register the new texture with the texturemanager:

    csRef<iTextureManager> txtmgr = g3d->GetTextureManager();

4: Create new material from the texture:

    csRef<iMaterial> videoMaterial(engine->CreateBaseMaterial(videoTexture));

5: Add the new material to the list of materials:

    iMaterialWrapper* videoMaterialWrapper = engine->GetMaterialList()->NewMaterial(videoMaterial,"videoMaterial");

6:  Assign new material to the meshobject


I also tried assigning it directly to the polygons, but that also didn't work:

    csRef<iThingFactoryState> state =
             scfQueryInterface<iThingFactoryState> (mesh->GetMeshObject ()->GetFactory());
    state->SetPolygonMaterial(CS_POLYRANGE_LAST, videoMaterialWrapper);

The end effect is that the object still has its original texture sad

how should this be done?

Pages: 1 2 [3] 4 5
Powered by MySQL Powered by PHP Powered by SMF 1.1.2 | SMF © 2006-2007, Simple Machines LLC Valid XHTML 1.0! Valid CSS!
Page created in 9.436 seconds with 15 queries.