2 registered members (AndrewAMD, juanex),
1,247
guests, and 6
spiders. |
Key:
Admin,
Global Mod,
Mod
|
|
|
Re: What are you working on?
[Re: oliver2s]
#434515
12/20/13 00:05
12/20/13 00:05
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
So, ummm, we are like doing grass now? May I join?
void World::CreateGrass()
{
RN::Model *grass = RN::Model::WithFile("models/dexsoft/grass/grass_1.sgm");
grass->GetMaterialAtIndex(0, 0)->culling = false;
grass->GetMaterialAtIndex(0, 0)->discard = true;
grass->GetMaterialAtIndex(0, 0)->override = RN::Material::OverrideGroupDiscard | RN::Material::OverrideCulling;
RN::InstancingNode *node = new RN::InstancingNode(grass);
RN::Random::MersenneTwister random;
for(int i = 0; i < 50000; i ++)
{
RN::Vector3 pos = RN::Vector3(random.RandomFloatRange(-100.0f, 100.0f), 0.0f, random.RandomFloatRange(-100.0f, 100.0f));
RN::Entity *ent = new RN::Entity(grass, pos);
entity->SetScale(random.RandomFloatRange(2.5f, 3.0f));
entity->SetRotation(RN::Vector3(random.RandomFloatRange(0, 360.0f), -90.0f, 0.0f));
node->AttachChild(entity);
}
_camera->ambient = RN::Vector4(0.127, 0.252, 0.393, 1.0f) * 2.0f;
_sunLight = new RN::Light(RN::Light::Type::DirectionalLight);
_sunLight->SetRotation(RN::Quaternion(RN::Vector3(60.0f, -60.0f, 0.0f)));
}
Edit: We added a fast path that covers exactly these kinds of things. Same code, "little" bit different FPS (it's capped at 1000): Edit2: Added another fast path. 1 million grass entities, my CPU is bored as fuck... GPU on the other hand is currently crying about the fragment operations. (to be fair, the screenshot is NOT staged, but the FPS changes quite heavily depending on how good it is with keeping up with all the fragments. But then again, I'm on a shitty HD 6770M, so with an actual GPU this isn't impossible to achieve in a stable way) Here is how this looks in the profiler: http://cl.widerwille.com/T2lx
Last edited by JustSid; 12/20/13 02:18.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
Re: What are you working on?
[Re: oliver2s]
#434551
12/20/13 18:23
12/20/13 18:23
|
Joined: Jun 2009
Posts: 2,210 Bavaria, Germany
Kartoffel
Expert
|
Expert
Joined: Jun 2009
Posts: 2,210
Bavaria, Germany
|
@^: I don't know what you think but I don't care if people post stuff which was made without gamestudio in here (the forum is almost dead anyway).
It's actually quite interesting, and as long as this thread isn't flooded by non-gamestudio posts I don't think a seperate thread is needed.
POTATO-MAN saves the day! - Random
|
|
|
Re: What are you working on?
[Re: oliver2s]
#434560
12/20/13 20:46
12/20/13 20:46
|
Joined: Oct 2007
Posts: 5,210 İstanbul, Turkey
Quad
Senior Expert
|
Senior Expert
Joined: Oct 2007
Posts: 5,210
İstanbul, Turkey
|
Hah, you are just giving me ideas about what to do with rayne.
3333333333
|
|
|
Re: What are you working on?
[Re: oliver2s]
#434562
12/20/13 21:05
12/20/13 21:05
|
Joined: Apr 2007
Posts: 3,751 Canada
WretchedSid
Expert
|
Expert
Joined: Apr 2007
Posts: 3,751
Canada
|
What I've seen so far was only a nice and fast engine for hardcore programmers, not usable for commercial games yet, but I know, it's still in development. Since we are already this far down the rabbit hole of off-topicness, please don't mind me asking this: Why do you think that? When creating this post, the biggest real "fuck you" in direction of Gamestudio I could come up with was attaching the actual source used to create the example above. Granted, this is not a real world example, but comparing it with the trickery that both Felix's did before me... Do you really want to tell me that I came up with the hardcore programmer example? Because I, and that may very well be just my opinion, think that it was pretty straight forward. It's written in C++ and uses another API than gamestudio, granted, but so does Unity and it isn't a hardcore programmer engine either. I mean, you don't need to know what happens under the hood in the example: It doesn't matter how the instancing data is created internally, it doesn't matter how the resource loader works and what it does to deduplicate your data. The only real strange thing I can find is the used random number generator, which, honestly, you could've just replace with rand() % 200 and be done with it. Our rng generator just gives you some nice extra functions on top of that (used to generate random floats within a range) and the guarantee that the produced numbers are uniformly distributed. Given that rand() is considered harmful and usually implemented using a cheap LCG, this might not be the worst thing in the world. So yeah, sorry for the rant, but I'm seriously curious why you think that's more hardcore programmer oriented than Gamestudio. Because for what it's worth, we put a lot of effort into designing the API and the default stuff so that it IS easy to use. Our shader framework may not be on par with Shade-C evo, but load a model with normal maps and/or spec maps and Rayne will automatically generate a shader for you at runtime that supports that. I'll give you the WYSIWYG editor, that is planned, but not there yet. One step at a time, we are just two people... Besides, who in their right mind creates commercial games with an alpha engine anyways? Edit: Throw in the following two lines and you got LOD and automatic removal of distant grass with the instancing:
node->SetPivot(_camera); // Use _camera to calculate which LOD stage to take
node->SetLimit(10000); // Max 10k visible around the pivot
Do that with Gamestudio in less lines of code, I dare you
Last edited by JustSid; 12/20/13 21:14.
Shitlord by trade and passion. Graphics programmer at Laminar Research. I write blog posts at feresignum.com
|
|
|
|