# Membrane

#11

Woo, membranes! Great work!

For now this is absolutely fine. In the future it’ll need to be fixed, but at the moment we really just need something that looks more attractive and realistic than the arrangement of hexagons already in place. I assume your algorithm doesn’t handle collisions since you didn’t mention it? That might be a little more important than other environmental distortion.

#12

Yeah, the things is that when I move the organelles, this happens:

The problem is that I average out the location of the points only when they are more than a set distance away from all the organelles. This can be fixed by making the organelles push really hard on the points, but then you can see jumps in the membrane which look too artificial. I could give you the code to play around with if you want. Hopefully you might find something I missed.

#13

I was going to complain about the deformation going on in the center of the mesh (ie, the sharp point on the near and far flat sides), but then I realized that it would not matter at all, because we’ll be using fresnel shaders. Very smart, good job.

Making the membrane respond to organelle movement is not necessary right now, and would probably require something like what tjwhale did with repulsion terms etc. That would probably necessitate changing how we construct the cell’s outline from your bezier/slope trickery, but the good news is that we could keep what you’ve done to turn the outline into a 3D solid.

#14

I think I’ve managed to make it a little better, see this video

What I did was simply change this function

``````def checkdistance(self):
truelocation = self.pos + Vector(centre[0],centre[1],centre[2])
for pt in controlpoints:
distance_to_organelle = distance(truelocation, pt.pos)
if distance_to_organelle <= 200:
spherical = tospherical(self.pos)
spherical.x += 30*math.exp(-distance_to_organelle/100)
self.pos = tocartesian(spherical)
``````

So basically the vertices flee from the organelles BUT when you are far from them flee slowly and when you are close to them flee faster. That way thy don’t suddenly jump. What was happening is that before I had it so if they were less than 100 they would add 30 to their radial coordinate. So they would be 102,101,100,130,129,128 etc and that was a bit horrible, I think this rather nicer they now flee at 30*exp(- distance/100) which decays nice a smoothly as they get further away.

Hope this is helpful! If there’s anything else I can do let me know,

#15

Shouldn’t really be too hard to fix, either way. I originally put it there as a place-holder and was planning to code a triangulation algorithm later, but eventually I realized that since we aren’t going to put an actual texture there, we shouldn’t worry about texture warping.

Too late Everything works now!

You are truly amazing! I took a look at your code and now everything works perfectly. I was already using an exponential function to control the movement, but no matter how much I tried I couldn’t make its look good. Interestingly enough, here is the function I used:
20*exp(- distance)
I was just one operation away from perfection Thanks again,

Here is an image of when the cell is moving upward fairly fast (the faster it goes, the more stretched out it becomes):

Keep in mind that it will be smoothed out even more once I make it three-dimensional. Eventually, I also plan to add motion blur to make it look even better.

#16

No problem, very glad I could help. I think in general I am trying rebrand myself in this project from Theorist to Programming Assistant. The main thing I want to do is help people build stuff so this is really pleasing. I’m glad you’re making good progress. Let me know what I can do to help, whatever, whenever.

#17

Time for another membrane update! For those of you not on slack, it might look that I (and the rest of the Thrive team) have disappeared for almost a month. Let me assure you that it isn’t so. Below is a picture of the current prototype of the membrane:

It has no organelles, is of one color, and has no collisions implemented—yet—but it is already so much better than the honeycombs we had previously.

I am looking forward to your critiques and suggestions (note that the jagged edges will be fixed once I turn on my sub-surf algorithm).

Edit: Fixed the jagged edges

#18

Awesome. *Applause.

#19

Ah yes, here it is—the final, rendered version of the cell membrane. It looks done; however, the material is only semi-permanent. Rather than messing with shaders, I simply used a texture that I laid over the vertices. Some day I will get to fixing it, but if we want to get this into the next release, it will have to do. Plus, I’d say it looks good this way too, even if it’s not at all customizable.

Anyway, I am now going to take a break for a few weeks, but when I get back I will start working on the physics (note the three cells in the top right) and getting the organelles back inside the cells.

Cheers.

Edit: Silly me, forgot to upload the picture

Organelle Models
#20

Sorry for double posting, but I have done some more work on the membrane. I have created the following semi-transparent texture for the membrane. The one I had previously looked good, but you wouldn’t be able to see the organelles in it; plus, I think this actually makes it look more “celly”.

Also, for those of you who don’t know this yet, I added physics, so you cannot go through a cell anymore. Basically, at this point I think that I am pretty much done with the membrane, and am ready to move on to some other part of the game.

#21

It looks amazing! The only thing I can think of for adding in the feature, besides the point where we try to make them move dynamically, is varied colourations for different species, and allowing the player to change their colouration in the editor. The texture especially looks very nice.

#22

Incredible work! I can’t really tell from the screenshot, but how apparent is the 3D-ness of the cells when playing? Have you made any progress on finding a way to map the flagella to the membrane edge?

The next release is going to be epic.

#23

Well, as I mentioned before, I’m using a colored texture instead of a shader, so it’s not that easy to change the color. But now that I think about it, I guess I could use a black and white texture and then color it in in the .material file.

It’s not apparent at all—the center of the microbe is completely transparent, so you only see a rough outline. But isn’t this how microbes look in real life under a microscope?

I’ll get working on it as soon as I have some free time, but I already have an idea of how this could work.

Edit: Okay, I’ve started working on the flagellum. It seems to be a lot easier than I had originally thought.

#24

Sorry to revive this thread, but my post is 100% related to this topic, so I didn’t want to start a new one.

Anyway, I was reading this interesting paper about how cells maintain their shape (basically, they have a high pressure on the inside, which inflates them similar to a balloon), and I thought that it would be interesting to code that in c++. Anyway, here is the result after a few hours of tinkering.

Possible improvements that I see: add drag forces to fix the unnatural acceleration (just friction looks really wonky), add springs on the inside that will act as microtubules, giving the cell a nonspherical shape, and allow the membrane to be manipulated by dragging.

Cheers.

#25

That looks cool.

IMO the trick to the dynamic membrane is going to be doing the calculations for it on the gpu. That way they can be super fast when you have a lot of microbes on screen.

#26

Looks great! Though I do strongly disagree with the idea of clicking and dragging to move the membrane, because I feel it’d get really annoying and tiring after a while.

#27

Yeah, that might not have been the best idea. I think we agreed on the community forum thread to only have engulfment be drag and drop and have everything else be normal WASD or click where you want to move. Would be easier to code that way too.

#28

IMO, engulfment should be WASD too. To me, click-and-drag engulfment in a game where movement is based around the WASD keys (assuming you’re gonna use those for regular movement) seems really awkward and counter-intuitive.

#29

Actually, WASD movement plus click and drag might lead to some fun situtations where you’ll be able to create a large wall with your body by dragging a portion of yourself laterally and moving forwards.

@TheCreator, that video is really cool! I’m kind of curious if it’d ever be able to displace the membrane like this:

#30

I’m not sure we need something as detailed as dragging the membrane over whatever’s being engulfed. My vote still goes to just moving over something to engulf it.

(Note this post is also meant to test the Discord API integration thing I just set up)