Working with texture data

Hi! I’m new to Xenko, but i like this engine and going to write some additional features.
Now i’m doing terrain rendering for my tasks. I’ve already understand how to create geometry from vertex/index buffers and setup materials. Now i want to load texture of height map from script properties and get height data from greyscale texture. I don’t understand now how to get color data or height data from texture object.
Can anyone help? I’m understanding i need CommandList to work with texture data, i used GraphicsContext.CommandList, but how to proceed then?

P.S. I see some properties and methods from Texture, i see texture.GetDataAsImage, and i see in Image data pointers, but how to get real data, there could be different data representation, so now i’m stuck!
Thank you in advance!

Problem solved! Now terrain rendering works, starting to do some optimizations, such as LODs and visibility.
Screen attached.
And, of course, solution of problem with reading texture data:

https://pastebin.com/jBTNtXXV

4 Likes

that’s really cool! could you imagine to work out a pull request? i think many people would love to see this in xenko…

Might be a bit early for a pull-request.

Maybe later as a template first, and then we will need to do some testing and performance profiling.

By the way, I think that is something we should consider for new features in Xenko (when they don’t involve change in the underlying engine):

  1. make a template that people can experiment with
  2. collect some usability feedback
  3. see if there are opportunities to move part of the code down to the engine (mostly for performance)
  4. test
  5. test more
  6. profit :slight_smile:

There are a lot of work even to show the result as sample. This is only tests for me to understand how Xenko rending works, and i have really a lot of questions to understand how to do it better.
As i don’t have a lot of time to create my own engine, and no have a lot of people to create good game - i decided to test, understand and create some good features for Xenko, cause i really liked this engine.
Before showing this terrain sample i’m going to create LOD optimization, visibility(now i don’t understand how Xenko works with visibility), terrain texture splatting, and, of course, collider. Only then i could think about pull request :slight_smile:
Sure, i’m planning to share code of features.

As i new to Xenko, where can i get feedback for some system questions of how to proceed with low level API and engine architecture. Now i’m working from empty engine sync script to generate terrain but i think this is really not good and fast.
For now what i need to continue:

  • how to create static collider component from code and generate shape(also what shape to use) for custom triangle data.
  • how to access frustum from script or how to refactor this generation to get access to RenderView to optimize visibility
  • how to install my own rendering shader(vertex and pixel) without any materials

P.S. It would be great to have more direct contact with users and development team to chat with more quickly. It would helps me a lot!

Thank you!

1 Like

It would be great to have more direct contact with users and development team to chat with more quickly

There are the discord channels for that: https://discord.gg/f6aerfE